Skip to content

Commit f5859e2

Browse files
jbachorikclaude
andauthored
ci: open PR for post-release version bump instead of direct push (#547)
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent b250b95 commit f5859e2

2 files changed

Lines changed: 25 additions & 1 deletion

File tree

.github/scripts/release.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,21 @@ CANDIDATE=$(./gradlew printVersion -Psnapshot=false | grep 'Version:' | cut -f2
127127
git add build.gradle.kts
128128
git commit -m "[Automated] Bump dev version to ${CANDIDATE}"
129129

130-
git push $DRYRUN --atomic --set-upstream origin $BRANCH
130+
if [ -z "$DRYRUN" ]; then
131+
BUMP_BRANCH="automated/bump-${CANDIDATE//./-}"
132+
git checkout -b "$BUMP_BRANCH"
133+
git push --set-upstream origin "$BUMP_BRANCH"
134+
BUMP_PR_URL=$(gh pr create \
135+
--title "[Automated] Bump dev version to ${CANDIDATE}" \
136+
--body "Automated version bump after releasing v${BASE}. Please review and merge." \
137+
--base "$BRANCH" \
138+
--head "$BUMP_BRANCH")
139+
echo "BUMP_PR_URL=$BUMP_PR_URL" >> "${GITHUB_OUTPUT:-/dev/null}"
140+
echo "⚠ Version bump PR requires manual approval: $BUMP_PR_URL"
141+
else
142+
git push $DRYRUN --atomic --set-upstream origin $BRANCH
143+
fi
144+
131145
git push $DRYRUN --atomic --tags
132146

133147
echo "==================== RELEASE SUMMARY ===================="

.github/workflows/release-validated.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ on:
2727
permissions:
2828
contents: write
2929
actions: read
30+
pull-requests: write
3031

3132
jobs:
3233
validate-inputs:
@@ -193,6 +194,7 @@ jobs:
193194
java-version: '21'
194195

195196
- name: Create release
197+
id: create-release
196198
env:
197199
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
198200
run: |
@@ -209,13 +211,21 @@ jobs:
209211
210212
- name: Output Release Summary
211213
if: ${{ inputs.dry_run != true }}
214+
env:
215+
BUMP_PR_URL: ${{ steps.create-release.outputs.BUMP_PR_URL }}
212216
run: |
213217
echo "## ✅ Release Created Successfully" >> $GITHUB_STEP_SUMMARY
214218
echo "" >> $GITHUB_STEP_SUMMARY
215219
echo "### Release Details" >> $GITHUB_STEP_SUMMARY
216220
echo "- **Tag**: v_${{ needs.validate-inputs.outputs.release_version }}" >> $GITHUB_STEP_SUMMARY
217221
echo "- **Branch**: ${{ needs.validate-inputs.outputs.release_branch }}" >> $GITHUB_STEP_SUMMARY
218222
echo "" >> $GITHUB_STEP_SUMMARY
223+
if [ -n "$BUMP_PR_URL" ]; then
224+
echo "### ⚠ Action Required" >> $GITHUB_STEP_SUMMARY
225+
echo "A version bump PR needs review and merge before the next snapshot builds carry the correct version:" >> $GITHUB_STEP_SUMMARY
226+
echo "- $BUMP_PR_URL" >> $GITHUB_STEP_SUMMARY
227+
echo "" >> $GITHUB_STEP_SUMMARY
228+
fi
219229
echo "### Next Steps (Automatic)" >> $GITHUB_STEP_SUMMARY
220230
echo "1. 🔨 GitLab pipeline will build multi-platform artifacts" >> $GITHUB_STEP_SUMMARY
221231
echo "2. 📦 GitLab will publish to Maven Central" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)