Skip to content

Commit 8f9e76b

Browse files
authored
Merge pull request #588 from ssl-hep/feat/version-bump-gha
Adding steps to pypi workflow - github bot commit version bump on release
2 parents c548ed2 + 7f3ceb8 commit 8f9e76b

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

.github/workflows/pypi.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ 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
15+
env:
16+
BRANCH: ${{ github.event.release.target_commitish }}
1417

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

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
66

77
[project]
88
name = "servicex"
9-
version = "3.1.1-alpha.1"
9+
version = "3.1.1"
1010
description = "Python SDK and CLI Client for ServiceX"
1111
readme = "README.md"
1212
license = { text = "BSD-3-Clause" } # SPDX short identifier

0 commit comments

Comments
 (0)