Skip to content

Commit db6da94

Browse files
MoshPeclaude
andcommitted
fix: open PR for version bump instead of pushing directly to main
main is protected by a ruleset requiring all changes via PR. Post-release version bump now creates a branch and opens a PR automatically using gh cli and GITHUB_TOKEN. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 0facf92 commit db6da94

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ jobs:
1010
runs-on: ubuntu-latest
1111
environment: MavenCentralDeploy
1212
permissions:
13-
contents: write # needed to create GitHub Release
13+
contents: write # needed to create GitHub Release and push branch
14+
pull-requests: write # needed to open the post-release version bump PR
1415

1516
steps:
1617
- name: Checkout
@@ -52,15 +53,24 @@ jobs:
5253
generate_release_notes: true
5354

5455
- name: Bump to next SNAPSHOT on main
56+
env:
57+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5558
run: |
5659
VERSION=${GITHUB_REF_NAME#v}
5760
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
5861
NEXT="${MAJOR}.${MINOR}.$((PATCH + 1))-SNAPSHOT"
62+
BRANCH="chore/bump-version-${NEXT}"
5963
git config user.name "github-actions[bot]"
6064
git config user.email "github-actions[bot]@users.noreply.github.com"
6165
git fetch origin main
62-
git checkout main
66+
git checkout -b ${BRANCH} origin/main
6367
mvn versions:set -DnewVersion=${NEXT} -DgenerateBackupPoms=false -N
6468
git add pom.xml
6569
git commit -m "chore: bump version to ${NEXT} [skip ci]"
66-
git push origin main
70+
git push origin ${BRANCH}
71+
gh pr create \
72+
--title "chore: bump version to ${NEXT}" \
73+
--body "Automated version bump after release \`${GITHUB_REF_NAME}\`." \
74+
--base main \
75+
--head ${BRANCH} \
76+
--label "dependencies"

0 commit comments

Comments
 (0)