From 144098c0aa9cad9dbb4a7ecd94cb27ed6f3f585a Mon Sep 17 00:00:00 2001 From: Cell Date: Sun, 3 May 2026 16:39:44 -0700 Subject: [PATCH] ci(publish): add automatic git tagging on successful release - Capture version from pyproject.toml after bumping - Create annotated Git tag when release succeeds - Push both version bump commit and tag to GitHub - Ensure tags are only pushed after successful PyPI upload --- .github/workflows/publish.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bc3d8004f..dee897aaa 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -102,6 +102,13 @@ jobs: - name: Bump version run: uv version --bump patch + - name: Capture new version + id: version + run: | + NEW_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/') + echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" + echo "New version: $NEW_VERSION" + - name: Build package run: | uv build @@ -112,7 +119,7 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} run: uv run twine upload --verbose dist/* - - name: Push version bump to GitHub + - name: Push version bump and tag to GitHub if: ${{ success() }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -121,4 +128,7 @@ jobs: git config --global user.email 'github-actions[bot]@users.noreply.github.com' git add . git commit -m "chore: bump version [ci skip]" || echo "No changes to commit" + TAG="v${{ steps.version.outputs.version }}" + git tag -a "$TAG" -m "Release $TAG" git push + git push origin "$TAG"