Skip to content

Commit 319fa49

Browse files
committed
update github actions versions to latest
1 parent 1a816d0 commit 319fa49

2 files changed

Lines changed: 44 additions & 83 deletions

File tree

.github/workflows/workflow.yaml

Lines changed: 43 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ jobs:
1818
runs-on: ubuntu-latest
1919
outputs:
2020
new_version: ${{ steps.release.outputs.new_version }}
21-
suffix: ${{ steps.release.outputs.suffix }}
22-
tag_name: ${{ steps.release.outputs.tag_name }}
21+
suffix: ${{ steps.release.outputs.suffix }}
22+
tag_name: ${{ steps.release.outputs.tag_name }}
2323
steps:
24-
- uses: actions/checkout@v2
24+
- uses: actions/checkout@v4
2525

2626
- name: Extract tag and Details
2727
id: release
@@ -31,139 +31,100 @@ jobs:
3131
NEW_VERSION=$(echo $TAG_NAME | awk -F'-' '{print $1}')
3232
SUFFIX=$(echo $TAG_NAME | grep -oP '[a-z]+[0-9]+' || echo "")
3333
echo "new_version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
34-
echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
34+
echo "suffix=$SUFFIX" >> "$GITHUB_OUTPUT"
3535
echo "tag_name=$TAG_NAME" >> "$GITHUB_OUTPUT"
36-
echo "Version is $NEW_VERSION"
37-
echo "Suffix is $SUFFIX"
38-
echo "Tag name is $TAG_NAME"
3936
else
40-
echo "No tag found"
41-
exit 1
37+
echo "No tag found"; exit 1
4238
fi
4339
4440
check_pypi:
4541
needs: details
4642
runs-on: ubuntu-latest
4743
steps:
48-
- name: Fetch information from PyPI
44+
- name: Check latest on PyPI
4945
run: |
5046
response=$(curl -s https://pypi.org/pypi/${{ env.PACKAGE_NAME }}/json || echo "{}")
51-
latest_previous_version=$(echo $response | jq --raw-output "select(.releases != null) | .releases | keys_unsorted | last")
52-
if [ -z "$latest_previous_version" ]; then
53-
echo "Package not found on PyPI."
54-
latest_previous_version="0.0.0"
55-
fi
56-
echo "Latest version on PyPI: $latest_previous_version"
57-
echo "latest_previous_version=$latest_previous_version" >> $GITHUB_ENV
58-
59-
- name: Compare versions and exit if not newer
47+
latest=$(echo $response | jq -r '.releases | keys_unsorted | last // "0.0.0"')
48+
echo "latest_previous_version=$latest" >> "$GITHUB_ENV"
49+
- name: Validate version bump
6050
run: |
61-
NEW_VERSION=${{ needs.details.outputs.new_version }}
62-
LATEST_VERSION=$latest_previous_version
63-
if [ "$(printf '%s\n' "$LATEST_VERSION" "$NEW_VERSION" | sort -rV | head -n 1)" != "$NEW_VERSION" ] || [ "$NEW_VERSION" == "$LATEST_VERSION" ]; then
64-
echo "The new version $NEW_VERSION is not greater than the latest version $LATEST_VERSION on PyPI."
65-
exit 1
66-
else
67-
echo "The new version $NEW_VERSION is greater than the latest version $LATEST_VERSION on PyPI."
51+
if [ "$(printf '%s\n' "$latest_previous_version" "${{ needs.details.outputs.new_version }}" | sort -rV | head -n1)" != "${{ needs.details.outputs.new_version }}" ]; then
52+
echo "New version is not greater than $latest_previous_version" && exit 1
6853
fi
6954
7055
setup_and_build:
7156
needs: [details, check_pypi]
7257
runs-on: ubuntu-latest
7358
steps:
74-
- uses: actions/checkout@v2
75-
76-
- name: Set up Python
77-
uses: actions/setup-python@v4
59+
- uses: actions/checkout@v4
60+
- name: Set Python
61+
uses: actions/setup-python@v5
7862
with:
79-
python-version: "3.11"
80-
63+
python-version: 3.11
8164
- name: Install Poetry
8265
run: |
8366
curl -sSL https://install.python-poetry.org | python3 -
8467
echo "$HOME/.local/bin" >> $GITHUB_PATH
85-
86-
- name: Set project version with Poetry
87-
run: |
88-
poetry version ${{ needs.details.outputs.new_version }}
89-
90-
- name: Install dependencies
68+
- name: Bump version via Poetry
69+
run: poetry version ${{ needs.details.outputs.new_version }}
70+
- name: Install deps
9171
run: poetry install --sync --no-interaction
92-
93-
- name: Install Pytorch
94-
run: pip3 install torch torchvision torchaudio
95-
96-
- name: Build source and wheel distribution
97-
run: |
98-
poetry build
99-
72+
- name: Install Torch
73+
run: pip install torch torchvision torchaudio
74+
- name: Build distributions
75+
run: poetry build
10076
- name: Upload artifacts
10177
uses: actions/upload-artifact@v3
10278
with:
10379
name: dist
10480
path: dist/
10581

10682
pypi_publish:
107-
name: Upload release to PyPI
108-
needs: [setup_and_build, details]
83+
needs: setup_and_build
10984
runs-on: ubuntu-latest
85+
environment: release
11086
permissions:
11187
id-token: write
11288
steps:
113-
- name: Download artifacts
114-
uses: actions/download-artifact@v3
89+
- uses: actions/download-artifact@v4
11590
with:
11691
name: dist
11792
path: dist/
118-
119-
- name: Publish distribution to PyPI
93+
- name: Publish to PyPI
12094
uses: pypa/gh-action-pypi-publish@release/v1
12195

12296
github_release:
123-
name: Create GitHub Release
124-
needs: [setup_and_build, details]
97+
needs: setup_and_build
12598
runs-on: ubuntu-latest
99+
environment: release
126100
permissions:
127101
contents: write
102+
id-token: write
128103
steps:
129-
- name: Checkout Code
130-
uses: actions/checkout@v3
104+
- uses: actions/checkout@v4
131105
with:
132106
fetch-depth: 0
133-
134-
- name: Download artifacts
135-
uses: actions/download-artifact@v3
107+
- uses: actions/download-artifact@v4
136108
with:
137109
name: dist
138110
path: dist/
139-
140111
- name: Create GitHub Release
141-
id: create_release
142-
env:
143-
GH_TOKEN: ${{ github.token }}
144-
run: |
145-
gh release create ${{ needs.details.outputs.tag_name }} dist/* --title ${{ needs.details.outputs.tag_name }} --generate-notes
112+
run: gh release create "${{ needs.details.outputs.tag_name }}" dist/* \
113+
--title "${{ needs.details.outputs.tag_name }}" \
114+
--generate-notes
146115

147116
bump_homebrew_formula:
148-
name: Dispatch event to Repo B
149-
needs: [details, github_release, pypi_publish]
117+
needs: [details, pypi_publish, github_release]
150118
runs-on: ubuntu-latest
151-
environment:
152-
name: release
153119
steps:
154-
- name: Dispatch Repository Dispatch event
155-
uses: peter-evans/repository-dispatch@v2
120+
- uses: peter-evans/repository-dispatch@v2
156121
with:
157122
token: ${{ secrets.BREW_TAP_TOKEN }}
158-
repository: ${{ env.OWNER }}/{{ env.TAP_NAME }}
159-
event-type: "update-formula"
160-
client-payload: |-
161-
{
162-
"formula_version": "${{env.FORMULA_VERSION}}",
163-
"formula_url": "${{ env.FORMULA_URL }}",
164-
"formula_name": "${{ env.FORMULA_NAME }}"
123+
repository: ${{ env.OWNER }}/${{ env.TAP_NAME }}
124+
event-type: update-formula
125+
client-payload: |
126+
{
127+
"formula_version": "${{ needs.details.outputs.new_version }}",
128+
"formula_url": "https://github.com/${{env.OWNER}}/${{env.PACKAGE_NAME}}/releases/download/${{ needs.details.outputs.new_version }}/${{env.PACKAGE_NAME}}-${{ needs.details.outputs.new_version }}.tar.gz",
129+
"formula_name": "${{ env.PACKAGE_NAME }}"
165130
}
166-
env:
167-
FORMULA_VERSION: ${{ needs.details.outputs.new_version }}
168-
FORMULA_NAME: ${{ env.PACKAGE_NAME }}
169-
FORMULA_URL: https://github.com/${{env.OWNER}}/${{env.PACKAGE_NAME}}/releases/download/${{ needs.details.outputs.new_version }}/${{env.PACKAGE_NAME}}-${{ needs.details.outputs.new_version }}.tar.gz

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "modelforge-finetuning"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = "ModelForge: A no-code toolkit for fine-tuning HuggingFace models"
55
authors = [
66
{name = "R3tr0 M1ll3r", email = "r3tr0.m1ll3r@gmail.com"},

0 commit comments

Comments
 (0)