Skip to content

Commit d9153c0

Browse files
authored
Merge pull request #643 from aws/fabisev/fix-ric-release-protected-branch
fix(ric): route release commits through PR to avoid protected main
2 parents 99e0349 + c8435cf commit d9153c0

1 file changed

Lines changed: 25 additions & 3 deletions

File tree

.github/workflows/release-runtime-interface-client.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ on:
2323
default: false
2424

2525
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
2829

2930
# Share the repo-wide "release" group with release.yml so RIC and the pure-Java
3031
# modules can never publish concurrently. Never cancel in-flight: it could leave
@@ -323,14 +324,35 @@ jobs:
323324
-Dgpg.keyname="$GPG_KEYNAME" -Dgpg.passphrase="$GPG_PASSPHRASE" \
324325
--file "$MODULE/pom.xml"
325326
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).
326331
- name: Tag and push (only after publish succeeds)
327332
if: ${{ github.event.inputs.skip_publish != 'true' }}
333+
env:
334+
GH_TOKEN: ${{ github.token }}
328335
run: |
336+
RELEASE_BRANCH="release/${TAG_NAME}"
337+
338+
# Release commit + tag (the tag points at the release version).
329339
git commit -am "chore(ric): release ${EFFECTIVE_RELEASE_VERSION}"
330340
git tag "$TAG_NAME"
341+
342+
# Next development version commit.
331343
mvn versions:set -DnewVersion="$NEXT_DEV_VERSION" -DgenerateBackupPoms=false --file "$MODULE/pom.xml"
332344
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)."
334356
335357
# Dry-run: validate assembly, no publish/push.
336358
- name: Dry-run assemble (no publish)

0 commit comments

Comments
 (0)