Skip to content

Commit f9135b9

Browse files
authored
Improve version bumping in deploy workflow
Refactor version bumping logic to check for changes before committing.
1 parent bba8cc8 commit f9135b9

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/deploy-pypi-release.yaml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,24 @@ jobs:
7777

7878
- name: Bump version (commit and push)
7979
run: |
80-
git config --global user.name 'github-actions[bot]'
81-
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
82-
git pull origin main --rebase
83-
git add setup.py pyproject.toml src/libcrypto/__init__.py
84-
git commit -m "chore: bump version to ${{ env.NEW_VERSION }}" || echo "No changes to commit"
80+
git config --global user.name 'github-actions[bot]'
81+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
82+
83+
# First add and commit changes
84+
git add setup.py pyproject.toml src/libcrypto/__init__.py
85+
86+
# Check if there are changes to commit
87+
if git diff --staged --quiet; then
88+
echo "No changes to commit"
89+
else
90+
git commit -m "bump version to ${{ env.NEW_VERSION }}"
91+
92+
# Pull with rebase strategy, auto-stash if needed
93+
git pull origin main --rebase --autostash || true
94+
95+
# Push changes
8596
git push origin main
97+
fi
8698
8799
- name: Install build tools
88100
run: |

0 commit comments

Comments
 (0)