fix(release): publish stable images via reusable workflow

- Stable release orchestration:
  - stop relying on a bot-created tag push to trigger stable image publication
  - capture the semantic-release result directly in the main release workflow
  - invoke the stable image publisher as a reusable workflow with the computed tag and release commit SHA

- Stable publish workflow:
  - convert the publish workflow from a `push.tags` trigger to `workflow_call`
  - keep a `workflow_dispatch` entry point so existing tags can be published manually for recovery
  - remove the obsolete `v2.2.1` bootstrap skip and use the release bot token for release finalization when available

- Branch hygiene:
  - automatically cherry-pick the semantic-release changelog commit from `main` back onto `develop`
  - avoid merge commits while keeping `CHANGELOG.md` aligned across the release and integration branches
  - skip the backport if the target release commit is already present on `develop`

- Validation:
  - parse both workflow files successfully with `yq`
  - pass `git diff --check`
This commit is contained in:
James Cox
2026-03-20 16:23:09 -05:00
parent 6c86f124c2
commit 03f4a8e22a
2 changed files with 117 additions and 8 deletions
+26 -8
View File
@@ -1,14 +1,32 @@
name: Release - Publish Stable Images
on:
push:
tags:
- 'v*'
workflow_call:
inputs:
release_tag:
description: 'The release tag to publish (for example v2.2.3)'
required: true
type: string
commit_sha:
description: 'The release commit SHA to package; if omitted, the tag ref is checked out'
required: false
default: ''
type: string
workflow_dispatch:
inputs:
release_tag:
description: 'The existing release tag to publish (for example v2.2.3)'
required: true
type: string
commit_sha:
description: 'Optional release commit SHA override'
required: false
default: ''
type: string
jobs:
build-and-release:
name: Build, Publish, and Finalize Stable Release
if: ${{ github.ref_name != 'v2.2.1' }}
runs-on: ubuntu-latest
permissions:
@@ -20,13 +38,13 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 1
ref: ${{ github.ref }}
ref: ${{ inputs.commit_sha != '' && inputs.commit_sha || format('refs/tags/{0}', inputs.release_tag) }}
- name: Record Release Tag and Commit
run: |
echo "release_tag=${GITHUB_REF_NAME}" >> "$GITHUB_ENV"
echo "release_tag=${{ inputs.release_tag }}" >> "$GITHUB_ENV"
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
echo "Stable release tag: ${GITHUB_REF_NAME}"
echo "Stable release tag: ${{ inputs.release_tag }}"
- name: Set Up QEMU for Multi-Arch Builds
uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 # v3
@@ -71,6 +89,6 @@ jobs:
- name: Publish Draft GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
run: |
gh release edit "${{ env.release_tag }}" --draft=false
+91
View File
@@ -36,6 +36,11 @@ jobs:
needs: [migration-check, test-suite]
runs-on: ubuntu-latest
outputs:
released: ${{ steps.release_state.outputs.released }}
release_tag: ${{ steps.release_state.outputs.release_tag }}
release_sha: ${{ steps.release_state.outputs.release_sha }}
permissions:
contents: write
@@ -56,6 +61,11 @@ jobs:
- name: Install Release Tooling Dependencies
run: npm --prefix tools/release ci
- name: Record Pre-Release HEAD
id: pre_release
run: |
echo "head_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Configure Release Bot Git Identity
env:
RELEASE_GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
@@ -73,3 +83,84 @@ jobs:
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
run: npx --prefix tools/release semantic-release --extends ./tools/release/release.config.cjs
- name: Capture Release State
id: release_state
run: |
set -eu
head_before="${{ steps.pre_release.outputs.head_sha }}"
head_after="$(git rev-parse HEAD)"
echo "release_sha=$head_after" >> "$GITHUB_OUTPUT"
if [ "$head_after" = "$head_before" ]; then
echo "released=false" >> "$GITHUB_OUTPUT"
echo "release_tag=" >> "$GITHUB_OUTPUT"
exit 0
fi
release_tag="$(git tag --points-at "$head_after" 'v*' | sort -V | tail -n 1)"
if [ -z "$release_tag" ]; then
echo "semantic-release advanced HEAD without creating a release tag" >&2
exit 1
fi
echo "released=true" >> "$GITHUB_OUTPUT"
echo "release_tag=$release_tag" >> "$GITHUB_OUTPUT"
publish-release:
name: Publish Stable Images
if: ${{ needs.semantic-release.outputs.released == 'true' }}
needs: [semantic-release]
uses: ./.github/workflows/publish-release.yml
permissions:
contents: write
packages: write
secrets: inherit
with:
release_tag: ${{ needs.semantic-release.outputs.release_tag }}
commit_sha: ${{ needs.semantic-release.outputs.release_sha }}
backport-release:
name: Backport Release Commit to Develop
if: ${{ needs.semantic-release.outputs.released == 'true' && needs.publish-release.result == 'success' }}
needs: [semantic-release, publish-release]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout Repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
persist-credentials: false
- name: Configure Release Bot Git Identity
env:
RELEASE_GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN != '' && secrets.RELEASE_BOT_TOKEN || github.token }}
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git remote set-url origin "https://x-access-token:${RELEASE_GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
- name: Cherry-pick Release Commit onto Develop
env:
RELEASE_SHA: ${{ needs.semantic-release.outputs.release_sha }}
RELEASE_TAG: ${{ needs.semantic-release.outputs.release_tag }}
run: |
set -eu
release_version="${RELEASE_TAG#v}"
git fetch origin main develop --tags
git checkout -B develop origin/develop
if git log --format=%s origin/develop | grep -Fxq "chore(release): ${release_version} [skip ci]"; then
echo "Develop already contains the release commit for ${RELEASE_TAG}; skipping backport."
exit 0
fi
git cherry-pick -x "$RELEASE_SHA"
git push origin HEAD:develop