1515 runs-on : ubuntu-latest
1616 strategy :
1717 matrix :
18- python-version : ["3.9", "3. 10", "3.11", "3.12", "3.13", "3.14"]
18+ python-version : ["3.10", "3.11", "3.12", "3.13", "3.14"]
1919
2020 steps :
2121 - uses : actions/checkout@v6
4747 runs-on : ubuntu-latest
4848 needs : test
4949 if : github.event_name == 'push' && github.ref == 'refs/heads/stable'
50+ permissions :
51+ contents : write
5052 steps :
53+ - name : Generate app token
54+ id : app-token
55+ uses : actions/create-github-app-token@v1
56+ with :
57+ app-id : ${{ secrets.CLOUDCHECK_APP_ID }}
58+ private-key : ${{ secrets.CLOUDCHECK_APP_PRIVATE_KEY }}
5159 - uses : actions/checkout@v6
60+ with :
61+ fetch-depth : 0
62+ token : ${{ steps.app-token.outputs.token }}
5263 - name : Set up Python
5364 uses : actions/setup-python@v6
5465 with :
@@ -57,10 +68,33 @@ jobs:
5768 uses : dtolnay/rust-toolchain@stable
5869 - name : Set up uv
5970 uses : astral-sh/setup-uv@v7
71+ - name : Get current version
72+ id : get_version
73+ run : |
74+ VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/')
75+ echo "VERSION=v${VERSION}" >> $GITHUB_OUTPUT
76+ - name : Check for version change
77+ id : version_check
78+ run : |
79+ git fetch --tags
80+ LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) 2>/dev/null || echo "none")
81+ CURRENT="${{ steps.get_version.outputs.VERSION }}"
82+ if [ "$LATEST_TAG" = "$CURRENT" ]; then
83+ echo "changed=false" >> $GITHUB_OUTPUT
84+ else
85+ echo "changed=true" >> $GITHUB_OUTPUT
86+ fi
6087 - name : Build PyPi package
6188 run : uv run maturin build --release --out dist
6289 - name : Publish PyPi package
6390 run : uv run maturin publish --skip-existing --username __token__ --password ${{ secrets.PYPI_TOKEN }}
91+ - name : Tag release
92+ if : steps.version_check.outputs.changed == 'true'
93+ run : |
94+ git config user.name "github-actions[bot]"
95+ git config user.email "github-actions[bot]@users.noreply.github.com"
96+ git tag -a "${{ steps.get_version.outputs.VERSION }}" -m "Release ${{ steps.get_version.outputs.VERSION }}"
97+ git push origin "refs/tags/${{ steps.get_version.outputs.VERSION }}"
6498 linux :
6599 runs-on : ${{ matrix.platform.runner }}
66100 needs : publish
0 commit comments