Skip to content

Commit 26b86c7

Browse files
Drop explicit 'latest' handling; rely on GitHub auto-latest
gh release create defaults to marking the highest-version release as "Latest", so a back-major release (e.g. a v2 hotfix) never steals the badge from the current major on its own. The explicit latest controls were therefore redundant, and rollback's badge edit conflicted with immutable releases. - release.yml: remove the latest input, the back-major latest guard, and the --latest flag on gh release create. - rollback.yml: remove the set_latest input and the gh release edit --latest badge step. Rollback now does only the major-tag move (matching the original runbook) plus the admin gate and built-artifact checks. The "Latest" badge is display-only and never affects what azure/login@vN resolves to, so this is behaviourally safe. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 50e030f commit 26b86c7

2 files changed

Lines changed: 4 additions & 51 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,6 @@ on:
2020
description: "Branch to release from. Use master for the current major (v3). For a back-major release (e.g. v2), branch a hotfix off the latest release tag (git checkout -b hotfix/v2.3.2 v2.3.1) and pass that hotfix/* branch."
2121
required: false
2222
default: master
23-
latest:
24-
description: "Mark as the latest release (only for the highest major, e.g. v3)"
25-
type: boolean
26-
default: true
2723

2824
permissions:
2925
contents: write # push branch/tag, force-move major tag, create the Release
@@ -78,27 +74,8 @@ jobs:
7874
with:
7975
ref: ${{ inputs.ref }} # master for the current major; a hotfix/* branch for a back-major release
8076
fetch-depth: 0
81-
# fetch tags so the 'latest' guard can find the highest major
8277
fetch-tags: true
8378

84-
- name: Guard 'latest' against back-major releases
85-
env:
86-
V: ${{ inputs.version }}
87-
LATEST: ${{ inputs.latest }}
88-
run: |
89-
# 'latest' controls only the "Latest" badge on the Releases page, of
90-
# which there is one per repo. Refuse to move it onto an older major
91-
# (e.g. a v2 hotfix must not steal the badge from v3).
92-
MAJOR="${V%%.*}" # v2.3.2 -> v2
93-
# Highest major among existing tags AND this release, so a brand-new
94-
# top major (e.g. first v4.0.0) is still allowed to be latest.
95-
HIGHEST=$(printf '%s\n' $(git tag -l 'v*' | grep -E '^v[0-9]+$') "$MAJOR" | sort -V | tail -1)
96-
echo "Release major: $MAJOR Highest major: $HIGHEST latest=$LATEST"
97-
if [[ "$LATEST" == "true" && "$MAJOR" != "$HIGHEST" ]]; then
98-
echo "::error::Refusing to mark $V as latest: $MAJOR is not the highest major ($HIGHEST). Re-run with latest=false for back-major releases."
99-
exit 1
100-
fi
101-
10279
- name: Ensure version is new
10380
env:
10481
V: ${{ inputs.version }}
@@ -159,11 +136,10 @@ jobs:
159136
env:
160137
GH_TOKEN: ${{ github.token }}
161138
V: ${{ inputs.version }}
162-
LATEST: ${{ inputs.latest }}
163139
run: |
164-
LATEST_FLAG="--latest=false"
165-
[[ "$LATEST" == "true" ]] && LATEST_FLAG="--latest"
140+
# No --latest flag: GitHub automatically marks the highest-version
141+
# release as "Latest", so a back-major release (e.g. a v2 hotfix) does
142+
# not steal the badge from the current major.
166143
gh release create "$V" \
167144
--title "Azure Login Action $V" \
168-
--generate-notes \
169-
"$LATEST_FLAG"
145+
--generate-notes

‎.github/workflows/rollback.yml‎

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ on:
1818
target_version:
1919
description: "Known-good version to roll the major tag back to, e.g. v3.0.1 (must be an existing tag)"
2020
required: true
21-
set_latest:
22-
description: "Also reset the GitHub 'Latest' release badge to target_version"
23-
type: boolean
24-
default: true
2521

2622
permissions:
2723
contents: write # force-move the major tag, update the Release
@@ -102,25 +98,6 @@ jobs:
10298
git tag -a "$MAJOR" -m "Rollback $MAJOR to $V" "$V"
10399
git push origin "$MAJOR" -f
104100
105-
- name: Reset 'Latest' release badge to target
106-
if: ${{ inputs.set_latest }}
107-
env:
108-
GH_TOKEN: ${{ github.token }}
109-
REPO: ${{ github.repository }}
110-
V: ${{ inputs.target_version }}
111-
run: |
112-
# Point the repo's single "Latest" badge back at the good version, so
113-
# the Releases page and /releases/latest stop advertising the bad one.
114-
# A tag can exist without a published Release, so tolerate a missing
115-
# release object: the critical tag rollback already succeeded above,
116-
# and the badge is cosmetic - warn rather than fail the whole rollback.
117-
if gh release view "$V" --repo "$REPO" >/dev/null 2>&1; then
118-
gh release edit "$V" --latest --repo "$REPO"
119-
echo "Set '$V' as the Latest release."
120-
else
121-
echo "::warning::No GitHub Release exists for $V, so the 'Latest' badge was not changed. The major tag rollback still succeeded. Create/publish a Release for $V if you want the badge updated."
122-
fi
123-
124101
- name: Summary
125102
env:
126103
V: ${{ inputs.target_version }}

0 commit comments

Comments
 (0)