File tree Expand file tree Collapse file tree 3 files changed +79
-3
lines changed
Expand file tree Collapse file tree 3 files changed +79
-3
lines changed Original file line number Diff line number Diff line change 1+ name : Publish Wheels
2+
3+ on :
4+ push :
5+ tags :
6+ - " v[0-9]*"
7+ - " test*"
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v5
14+ with :
15+ ref : ${{ github.ref }}
16+ fetch-depth : 0
17+
18+ - uses : actions/setup-python@v5
19+ with :
20+ python-version : " 3.12"
21+
22+ - name : Build wheel and sdist
23+ run : |
24+ python -m pip install --upgrade pip build
25+ python -m build
26+
27+ - uses : actions/upload-artifact@v4
28+ with :
29+ name : dist
30+ path : dist/*
31+
32+ publish :
33+ name : Publish to PyPI
34+ needs : [build]
35+ runs-on : ubuntu-latest
36+ permissions :
37+ id-token : write
38+ contents : read
39+ steps :
40+ - uses : actions/download-artifact@v4
41+ with :
42+ name : dist
43+ path : dist
44+
45+ - name : Publish to TestPyPI (test tags)
46+ if : startsWith(github.ref, 'refs/tags/test')
47+ uses : pypa/gh-action-pypi-publish@release/v1
48+ with :
49+ repository-url : https://test.pypi.org/legacy/
50+ packages-dir : dist
51+ skip-existing : true
52+ verbose : true
53+
54+ - name : Publish to PyPI (real releases)
55+ if : startsWith(github.ref, 'refs/tags/v')
56+ uses : pypa/gh-action-pypi-publish@release/v1
57+ with :
58+ packages-dir : dist
Original file line number Diff line number Diff line change @@ -19,11 +19,21 @@ jobs:
1919 ref : develop
2020 fetch-depth : 0
2121 token : ${{ secrets.BOT_ACCESS_TOKEN }}
22+
2223 - name : Bump version
2324 run : ./.github/workflows/version_bumper.sh ./pyproject.toml
25+ id : bump
26+
2427 - name : Commit and push
2528 run : |
2629 git config user.name "AVSlabBot"
2730 git config user.email "cuavslab@gmail.com"
2831 git commit -a -m "[AUTO] Bump minor version number"
2932 git push
33+
34+ - name : Create tag
35+ if : ${{ steps.bump.outputs.updated_version != '' }}
36+ run : |
37+ git tag -a "v${{ steps.bump.outputs.updated_version }}" \
38+ -m "Release v${{ steps.bump.outputs.updated_version }}"
39+ git push --tags
Original file line number Diff line number Diff line change @@ -23,12 +23,20 @@ if [[ $version_line =~ $regex ]]; then
2323 last_number=${BASH_REMATCH[2]}
2424 incremented_number=$(( last_number + 1 ))
2525 updated_version=${BASH_REMATCH[1]} $incremented_number
26-
26+
2727 # Update the version in the pyproject.toml file
2828 sed -i " s/version = \" ${BASH_REMATCH[1]}${last_number} \" /version = \" $updated_version \" /" " $file "
29-
29+
3030 echo " Version updated to $updated_version in $file "
3131else
3232 echo " Error: Version not found in $file or not in X.Y.Z format"
3333 exit 1
34- fi
34+ fi
35+
36+
37+ # Expose the update versions to GitHub Actions
38+ if [[ -n " ${GITHUB_OUTPUT:- } " ]]; then
39+ {
40+ echo " updated_version=$updated_version "
41+ } >> " $GITHUB_OUTPUT "
42+ fi
You can’t perform that action at this time.
0 commit comments