Skip to content

Commit a470cbf

Browse files
fix(ci): scope nightly targets and gate api-tag/release-PR to stable
nightly-rc.yaml's `release-[0-9]*.[0-9]*` glob also matched the per-tag staging branches tags.yaml creates (release-1.4.0, release-1.4.0-rc.2, release-1.5.0-nightly.<date>), cutting spurious nightly tags. Anchor the target selection with a `^release-[0-9]+\.[0-9]+$` regex. tags.yaml now exposes an is_stable output and gates the write-once api/apps/v1alpha1 Go-module tag and the auto-opened release PR on it, so an rc/beta/alpha (is_stable=false) or a nightly (is_stable unset) never pollutes the module proxy or opens a release PR (#2677 goal 3). Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 3a7bb8a commit a470cbf

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

‎.github/workflows/nightly-rc.yaml‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ jobs:
5555
# Tracked targets: main + every release-X.Y maintenance branch.
5656
targets="main"
5757
for b in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin/release-* 2>/dev/null); do
58-
case "$b" in
59-
origin/release-[0-9]*.[0-9]*) targets="$targets ${b#origin/}" ;;
60-
esac
58+
br="${b#origin/}"
59+
# Only exact two-component maintenance branches (release-X.Y). A bare
60+
# shell glob also matches the per-tag staging branches tags.yaml
61+
# creates (release-1.4.0, release-1.4.0-rc.2, release-1.5.0-nightly.<date>),
62+
# so anchor with a regex to drop them.
63+
printf '%s\n' "$br" | grep -qE '^release-[0-9]+\.[0-9]+$' && targets="$targets $br"
6164
done
6265
6366
# Highest vX.Y.Z stable tag (ignores prereleases) for next-version math.

‎.github/workflows/tags.yaml‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ jobs:
8383
core.setOutput('tag', ref); // v0.31.5-rc.1
8484
core.setOutput('version', version); // 0.31.5-rc.1
8585
core.setOutput('is_rc', isRc); // true
86+
core.setOutput('is_stable', !isRc); // true only for a plain vX.Y.Z
8687
core.setOutput('line', `${maj}.${min}`); // 0.31
8788
8889
# Detect base branch (main or release-X.Y) the tag was pushed from
@@ -154,8 +155,12 @@ jobs:
154155
# pkg.go.dev, where a moved tag poisons caches irreversibly. Create the tag
155156
# only when absent; if it already points at the same commit, no-op; if it
156157
# exists pointing elsewhere, fail loudly rather than force-move it.
158+
# Stable releases only: an immutable Go-module tag must never be cut for an
159+
# rc/beta/alpha (is_stable=false) or a nightly (is_stable unset — Parse tag
160+
# rejects -nightly before this), which would permanently pollute the module
161+
# proxy with a prerelease version (#2677 goal 3).
157162
- name: Tag API submodule (write-once)
158-
if: steps.check_release.outputs.skip == 'false'
163+
if: steps.check_release.outputs.skip == 'false' && steps.tag.outputs.is_stable == 'true'
159164
env:
160165
APP_TOKEN: ${{ steps.app-token.outputs.token }}
161166
VTAG: ${{ steps.tag.outputs.tag }}
@@ -245,9 +250,10 @@ jobs:
245250
git push -f origin "HEAD:refs/heads/${BRANCH}"
246251
fi
247252
248-
# Create pull request into original base branch (if absent)
253+
# Create pull request into original base branch (if absent). Stable only —
254+
# an rc/nightly must not auto-open a release PR (#2677 goal 3).
249255
- name: Create pull request if not exists
250-
if: steps.check_release.outputs.skip == 'false'
256+
if: steps.check_release.outputs.skip == 'false' && steps.tag.outputs.is_stable == 'true'
251257
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
252258
with:
253259
github-token: ${{ steps.app-token.outputs.token }}

0 commit comments

Comments
 (0)