Skip to content

Commit 0e231e8

Browse files
fix: add major version tag update to release workflow (#465)
* fix: add major version tag update to release workflow ## What Added an `update_major_tag` job to the release workflow that force-updates the floating major version tag (e.g., `v9`) to point to the latest release tag after each release is published. ## Why Releases created by `github-actions[bot]` using `GITHUB_TOKEN` do not trigger downstream workflows due to GitHub's anti-cascade protection. The standalone `major-version-updater.yml` workflow, which listens for `release: published` events, was never firing for v9.x releases. Moving the logic into the release workflow itself ensures the major tag update runs as part of the same pipeline. ## Notes - The standalone `major-version-updater.yml` is intentionally kept as a manual `workflow_dispatch` fallback - The job guards on `needs.release.outputs.full-tag != ''` to skip when no release is produced - Unlike the standalone workflow, this does NOT set `persist-credentials: false` on checkout — credentials are needed for `git push` Co-Authored-By: Kenyatta <153775386+Kenyatta-forbes@users.noreply.github.com> Signed-off-by: jmeridth <jmeridth@gmail.com> * fix: set persist-credentials to true for major tag update workflows ## What Changed `persist-credentials` from `false` to `true` in the standalone `major-version-updater.yml` and explicitly set it to `true` in the new `update_major_tag` job in `release.yml`. ## Why The standalone workflow fails on `git push` with "could not read Username" because `persist-credentials: false` strips the git credentials after checkout. Both workflows need credentials to force-push the major version tag. ## Notes - The standalone workflow has been broken since the `persist-credentials: false` change was introduced, which is why all manual dispatch runs in April 2025 failed before succeeding (credentials were likely configured differently in the successful runs) - `persist-credentials: true` is the default for `actions/checkout`, but being explicit here documents the intentional choice since `git push` depends on it Co-Authored-By: Kenyatta <153775386+Kenyatta-forbes@users.noreply.github.com> Signed-off-by: jmeridth <jmeridth@gmail.com> * fix: simplify major tagging with existing output Signed-off-by: jmeridth <jmeridth@gmail.com> --------- Signed-off-by: jmeridth <jmeridth@gmail.com> Co-authored-by: Kenyatta <153775386+Kenyatta-forbes@users.noreply.github.com>
1 parent 2f55ec4 commit 0e231e8

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

.github/workflows/major-version-updater.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
with:
2929
fetch-tags: true
3030
ref: ${{ github.event.inputs.TAG_NAME || github.ref }}
31-
persist-credentials: false
31+
persist-credentials: true
3232
- name: version
3333
id: version
3434
run: |

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,33 @@ jobs:
3535
image-registry: ghcr.io
3636
image-registry-username: ${{ github.actor }}
3737
image-registry-password: ${{ secrets.GITHUB_TOKEN }}
38+
update_major_tag:
39+
needs: release
40+
if: ${{ needs.release.outputs.full-tag != '' }}
41+
runs-on: ubuntu-latest
42+
permissions:
43+
contents: write
44+
steps:
45+
- name: Harden the runner (Audit all outbound calls)
46+
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
47+
with:
48+
egress-policy: audit
49+
50+
- name: Checkout Repo
51+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
52+
with:
53+
fetch-tags: true
54+
ref: ${{ needs.release.outputs.full-tag }}
55+
persist-credentials: true
56+
57+
- name: Force update major tag
58+
run: |
59+
git tag -f "${SHORT}" "${FULL}"
60+
git push -f origin "${SHORT}"
61+
env:
62+
SHORT: ${{ needs.release.outputs.short-tag }}
63+
FULL: ${{ needs.release.outputs.full-tag }}
64+
3865
release_discussion:
3966
needs: release
4067
permissions:

0 commit comments

Comments
 (0)