Skip to content

Commit f2fe728

Browse files
authored
Open pyproject version bump PR from release draft (#179)
## Summary Follow-up to #178 after revisiting the release flow: - Keeps the Release Drafter upgrade to `v7.5.1` from #178 for the Node 24 warning cleanup. - Changes the pyproject version sync from a direct push to `main` into an automatic version-bump PR created with `peter-evans/create-pull-request@v8.1.1`. - This makes the version bump happen after Release Drafter resolves the next draft version, but before the draft release should be published. - The PyPI workflow from #178 still publishes on `release.published` and verifies `pyproject.toml` matches the release tag. ## Repo setting checked The repository already has the required Actions settings for this approach: - `default_workflow_permissions`: `write` - `can_approve_pull_request_reviews`: `true` That means `GITHUB_TOKEN` is allowed to create the version-bump PR. ## Verification - `actionlint .github/workflows/release-drafter.yaml .github/workflows/publish-pypi.yml` → passed - YAML parse check for both workflows → passed - Ad-hoc `/tmp/hermes-verify-release-workflows.py` → passed: release-drafter action version, pyproject bump PR gating, and publish version check match/reject behavior - `git diff --check` → passed
1 parent bc90f3c commit f2fe728

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

‎.github/workflows/release-drafter.yaml‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ jobs:
2424
prerelease: false
2525
env:
2626
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27-
- name: Sync pyproject version to release draft
27+
- name: Update pyproject version from release draft
28+
id: pyproject-version
2829
env:
2930
RESOLVED_VERSION: ${{ steps.release-drafter.outputs.resolved_version }}
3031
run: |
@@ -55,11 +56,22 @@ jobs:
5556
5657
if git diff --quiet -- pyproject.toml; then
5758
echo "pyproject.toml already matches ${RESOLVED_VERSION}"
58-
exit 0
59+
echo "changed=false" >> "$GITHUB_OUTPUT"
60+
else
61+
echo "pyproject.toml will be bumped to ${RESOLVED_VERSION}"
62+
echo "changed=true" >> "$GITHUB_OUTPUT"
5963
fi
6064
61-
git config user.name "github-actions[bot]"
62-
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
63-
git add pyproject.toml
64-
git commit -m "chore: bump pyproject version to ${RESOLVED_VERSION}"
65-
git push
65+
- name: Open pyproject version bump PR
66+
if: steps.pyproject-version.outputs.changed == 'true'
67+
uses: peter-evans/create-pull-request@v8.1.1
68+
with:
69+
branch: chore/bump-pyproject-version
70+
delete-branch: true
71+
commit-message: "chore: bump pyproject version to ${{ steps.release-drafter.outputs.resolved_version }}"
72+
title: "Bump pyproject version to ${{ steps.release-drafter.outputs.resolved_version }}"
73+
body: |
74+
Release Drafter resolved the next release as `${{ steps.release-drafter.outputs.resolved_version }}`.
75+
76+
This PR updates `pyproject.toml` before the draft release is published so the PyPI publish workflow can build a package whose version matches the release tag.
77+
labels: release

0 commit comments

Comments
 (0)