Skip to content

Commit 5f95bde

Browse files
authored
Update pypi.yaml - commit
adding two extra steps to commit version bump to pyproject
1 parent c548ed2 commit 5f95bde

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

.github/workflows/pypi.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
# c.f. https://docs.pypi.org/trusted-publishers/using-a-publisher/
1212
permissions:
1313
id-token: write
14+
contents: write # required to push with GITHUB_TOKEN
1415

1516
steps:
1617
- uses: actions/checkout@v4
@@ -42,6 +43,26 @@ jobs:
4243
run: |
4344
sed -i '/version =/ s/= "[^"][^"]*"/ = "${{ env.RELEASE_VERSION }}"/' pyproject.toml
4445
46+
- name: commit version-bump
47+
run: |
48+
git config --local user.name "github-actions[bot]"
49+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
50+
git add ./pyproject.toml
51+
52+
# Check if there are changes to commit
53+
if ! git diff --cached --quiet; then
54+
echo "Changes detected, committing..."
55+
git commit -m "Update version to ${{ env.RELEASE_VERSION }}" --no-verify
56+
else
57+
echo "No changes to commit"
58+
fi
59+
60+
- name: Push commit
61+
# GITHUB_TOKEN is automatically provided
62+
run: |
63+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
64+
git push origin HEAD:$BRANCH
65+
4566
- name: Build a sdist and wheel
4667
run: |
4768
python -m build .

0 commit comments

Comments
 (0)