|
23 | 23 | default: false |
24 | 24 |
|
25 | 25 | permissions: |
26 | | - contents: write # push release commit and tag |
27 | | - id-token: write # assume the OIDC role for secret retrieval |
| 26 | + contents: write # push the release tag and the version-bump branch |
| 27 | + id-token: write # assume the OIDC role for secret retrieval |
| 28 | + pull-requests: write # open the post-release version-bump PR into main |
28 | 29 |
|
29 | 30 | # Share the repo-wide "release" group with release.yml so RIC and the pure-Java |
30 | 31 | # modules can never publish concurrently. Never cancel in-flight: it could leave |
@@ -323,14 +324,35 @@ jobs: |
323 | 324 | -Dgpg.keyname="$GPG_KEYNAME" -Dgpg.passphrase="$GPG_PASSPHRASE" \ |
324 | 325 | --file "$MODULE/pom.xml" |
325 | 326 |
|
| 327 | + # main is protected (no direct push), so push the tag (tag pushes aren't |
| 328 | + # gated by branch protection) and route the release + next-development |
| 329 | + # version-bump commits through a PR, mirroring release.yml. A direct |
| 330 | + # `git push ... HEAD:main` here is rejected with GH006 (protected branch). |
326 | 331 | - name: Tag and push (only after publish succeeds) |
327 | 332 | if: ${{ github.event.inputs.skip_publish != 'true' }} |
| 333 | + env: |
| 334 | + GH_TOKEN: ${{ github.token }} |
328 | 335 | run: | |
| 336 | + RELEASE_BRANCH="release/${TAG_NAME}" |
| 337 | +
|
| 338 | + # Release commit + tag (the tag points at the release version). |
329 | 339 | git commit -am "chore(ric): release ${EFFECTIVE_RELEASE_VERSION}" |
330 | 340 | git tag "$TAG_NAME" |
| 341 | +
|
| 342 | + # Next development version commit. |
331 | 343 | mvn versions:set -DnewVersion="$NEXT_DEV_VERSION" -DgenerateBackupPoms=false --file "$MODULE/pom.xml" |
332 | 344 | git commit -am "chore(ric): prepare next development ${NEXT_DEV_VERSION}" |
333 | | - git push --atomic origin "HEAD:${GITHUB_REF_NAME}" "refs/tags/${TAG_NAME}" |
| 345 | +
|
| 346 | + # Tag push isn't gated by branch protection; the version-bump commits |
| 347 | + # go to a release branch and land on main via PR. |
| 348 | + git push origin "refs/tags/${TAG_NAME}" |
| 349 | + git push origin "HEAD:refs/heads/${RELEASE_BRANCH}" |
| 350 | +
|
| 351 | + gh pr create \ |
| 352 | + --base "${GITHUB_REF_NAME}" \ |
| 353 | + --head "${RELEASE_BRANCH}" \ |
| 354 | + --title "chore(release): ${MODULE} ${EFFECTIVE_RELEASE_VERSION}" \ |
| 355 | + --body "Post-release version bump for ${MODULE} ${EFFECTIVE_RELEASE_VERSION} (already on Maven Central, tag ${TAG_NAME} pushed)." |
334 | 356 |
|
335 | 357 | # Dry-run: validate assembly, no publish/push. |
336 | 358 | - name: Dry-run assemble (no publish) |
|
0 commit comments