Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

fix(open-knowledge): stamp Linear releases from the cut tag, not a predicted version (PRD-7751) (#3143)

Andrew Mikofalvy05d6936d8412
diff --git a/.github/scripts/derive-release-stamp.mjs b/.github/scripts/derive-release-stamp.mjs
new file mode 100644
index 000000000..5172ef64b
--- /dev/null
+++ b/.github/scripts/derive-release-stamp.mjs
@@ -0,0 +1,221 @@
+#!/usr/bin/env node
+/**
+ * Decide which Linear release a cut stamps its tickets onto, and how far back
+ * to scan for them.
+ *
+ * Why the tag is used verbatim. The obvious identity for a beta cut is its
+ * "eventual" stable version — strip `-beta.N` and key on what remains. That
+ * number is a PREDICTION made at cut time (`anchor + max bump of the pending
+ * pile`); the real stable version is computed later, at promote time, against a
+ * delta that has moved since. Keying a release on it attributes tickets to
+ * versions that never shipped them, and always in the same direction: too
+ * early. A tag's own name has no such failure mode — `v0.46.0-beta.3` is
+ * literally the ref that was cut, so it is used as-is.
+ *
+ * Why the scan range depends on the channel. The lower bound is an exclusive
+ * `<base>..<tag>` boundary for the commit scan that finds ticket identifiers.
+ *
+ * beta -> the previous tag of any kind. The beta release then holds what is
+ * NEW in that beta, so a ticket lands on the beta it FIRST shipped
+ * in rather than on every subsequent one.
+ * stable -> the previous STABLE tag, skipping betas. A stable promotion
+ * batches every changeset since the last stable, so its scan has to
+ * reach back that far; stopping at the most recent beta would miss
+ * every ticket from earlier betas in the cycle.
+ *
+ * The two together give a ticket exactly two attachments — the beta it first
+ * appeared in and the stable that shipped it — with no predicted version
+ * anywhere in the chain.
+ *
+ * Usage:
+ * node .github/scripts/derive-release-stamp.mjs <tag>
+ *
+ * Must run inside a full clone (`fetch-depth: 0`, `fetch-tags: true`) — both
+ * lower-bound strategies read the tag list and the history behind it.
+ *
+ * Emits JSON to stdout and, under Actions, appends
+ * channel / version / name / base_ref
+ * to $GITHUB_OUTPUT. Logs go to stderr.
+ *
+ * Fail-loud contract, matching the sibling release scripts: "this is the first
+ * stable ever, so there is no lower bound" is a real ANSWER and exits 0 with an
+ * empty base_ref, which the sync action reads as "use your own default". A tag
+ * that cannot be parsed exits non-zero rather than being coerced — stamping the
+ * wrong release is worse than not stamping.
+ */
+import { spawnSync } from 'node:child_process';
+import { appendFileSync } from 'node:fs';
+import { pathToFileURL } from 'node:url';
+
+const STABLE_TAG_RE = /^v(\d+)\.(\d+)\.(\d+)$/;
+const BETA_TAG_RE = /^v(\d+)\.(\d+)\.(\d+)-beta\.(\d+)$/;
+
+function log(...args) {
+ process.stderr.write(`${args.join(' ')}\n`);
+}
+
+/**
+ * Classify a release tag and derive the identity its Linear release carries.
+ *
+ * `version` keeps the prerelease suffix for a beta. That is the whole point:
+ * the suffix is what makes a beta's identity a fact rather than a forecast.
+ *
+ * Throws on anything that is not one of the two recognized shapes. A release
+ * cadence that silently stamps an unrecognized ref would attribute tickets to a
+ * release nobody can find.
+ */
+export function parseReleaseTag(rawTag) {
+ const tag = String(rawTag ?? '').trim();
+ if (!tag) throw new Error('missing release tag');
+
+ const beta = BETA_TAG_RE.exec(tag);
+ if (beta) return { channel: 'beta', version: tag.slice(1), name: tag };
+
+ const stable = STABLE_TAG_RE.exec(tag);
+ if (stable) return { channel: 'stable', version: tag.slice(1), name: tag };
+
+ throw new Error(
+ `unrecognized release tag '${tag}' (expected vX.Y.Z or vX.Y.Z-beta.N)`,
+ );
+}
+
+/** Numeric semver key for a stable tag, or null if it is not one. */
+function stableKey(rawTag) {
+ const m = STABLE_TAG_RE.exec(String(rawTag).trim());
+ return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null;
+}
+
+function compareKeys(a, b) {
+ return a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
+}
+
+/**
+ * Highest stable tag strictly below `tag`, or null when none exists.
+ *
+ * Comparison is numeric per component, never lexicographic — `v0.10.0` sorts
+ * above `v0.9.0`, which a string sort gets backwards and which this repo's
+ * version range has already crossed.
+ *
+ * Beta tags are skipped entirely rather than ordered among the stables: the
+ * caller wants the previous PRODUCTION boundary, and a beta is not one.
+ */
+export function previousStableTag({ tags, tag }) {
+ const ceiling = stableKey(tag);
+ if (!ceiling) {
+ throw new Error(`previousStableTag needs a stable tag, got '${tag}'`);
+ }
+ let best = null;
+ for (const candidate of tags ?? []) {
+ const key = stableKey(candidate);
+ if (!key) continue;
+ if (compareKeys(key, ceiling) >= 0) continue;
+ if (best === null || compareKeys(key, best.key) > 0) {
+ best = { tag: String(candidate).trim(), key };
+ }
+ }
+ return best ? best.tag : null;
+}
+
+/**
+ * Full stamp decision. Boundaries are injected:
+ * describePreviousTag(tag) -> string | null (nearest tag of any kind below `tag`)
+ *
+ * `describePreviousTag` is only consulted on the beta path, so a stable
+ * promotion needs no history walk at all — just the tag list.
+ */
+export function deriveReleaseStamp({ tag, tags, describePreviousTag }) {
+ const parsed = parseReleaseTag(tag);
+ const baseRef =
+ parsed.channel === 'beta'
+ ? (describePreviousTag(parsed.name) ?? null)
+ : previousStableTag({ tags, tag: parsed.name });
+ return { ...parsed, baseRef: baseRef || null };
+}
+
+// --- workflow-runtime wiring (real git boundary) ---
+
+function runGit(args) {
+ const res = spawnSync('git', args, { encoding: 'utf8' });
+ if (res.status !== 0) {
+ throw new Error(
+ `git ${args.join(' ')} failed (exit ${res.status}): ${String(res.stderr || '').trim()}`,
+ );
+ }
+ return String(res.stdout || '');
+}
+
+function realTags() {
+ return runGit(['tag', '--list', 'v*'])
+ .split('\n')
+ .map((line) => line.trim())
+ .filter(Boolean);
+}
+
+// The nearest tag reachable from the commit BEFORE this one, which is the
+// exclusive lower bound the scan wants.
+//
+// `git describe` exits 128 for both "there is genuinely no tag back there" and
+// for real infra failures, so the exit code alone cannot discriminate the way
+// `merge-base --is-ancestor`'s exit 1 does for the sibling script. The two
+// legitimate empty answers are matched on git's own sentinels instead:
+// no tag in the ancestry, and a root commit that has no `^` parent. Anything
+// else — an unreadable object, a killed process — throws, because silently
+// reading it as "no lower bound" would widen the scan without saying so.
+const NO_PREVIOUS_TAG_SENTINELS = [/No names found/i, /unknown revision/i];
+
+function realDescribePreviousTag(tag) {
+ const res = spawnSync('git', ['describe', '--tags', '--abbrev=0', `${tag}^`], {
+ encoding: 'utf8',
+ });
+ if (res.status === 0) return String(res.stdout || '').trim() || null;
+ const stderr = String(res.stderr || '');
+ if (NO_PREVIOUS_TAG_SENTINELS.some((re) => re.test(stderr))) return null;
+ throw new Error(
+ `git describe --tags --abbrev=0 ${tag}^ failed (exit ${res.status}): ${stderr.trim()}`,
+ );
+}
+
+/**
+ * The step-output contract the workflow consumes.
+ *
+ * An absent lower bound is emitted as an EMPTY `base_ref`, which the sync action
+ * reads as "use your own default". Emitting a placeholder like `HEAD` instead
+ * would narrow the first-ever scan to nothing, so this coalesce is load-bearing
+ * and lives here, out of `main()`, to stay directly testable.
+ */
+export function formatOutputLines(result) {
+ return [
+ `channel=${result.channel}`,
+ `version=${result.version}`,
+ `name=${result.name}`,
+ `base_ref=${result.baseRef ?? ''}`,
+ ];
+}
+
+function main() {
+ let result;
+ try {
+ result = deriveReleaseStamp({
+ tag: process.argv[2],
+ tags: realTags(),
+ describePreviousTag: realDescribePreviousTag,
+ });
+ } catch (err) {
+ console.error(`::error::derive-release-stamp: ${err.message}`);
+ process.exit(1);
+ }
+
+ log(
+ `tag=${result.name} channel=${result.channel} version=${result.version} base_ref=${result.baseRef ?? '<none>'}`,
+ );
+ console.log(JSON.stringify(result));
+
+ if (process.env.GITHUB_OUTPUT) {
+ appendFileSync(process.env.GITHUB_OUTPUT, `${formatOutputLines(result).join('\n')}\n`);
+ }
+}
+
+// Run main() only as a CLI, not when imported by the test file.
+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
+ main();
+}
diff --git a/.github/scripts/derive-release-stamp.test.mjs b/.github/scripts/derive-release-stamp.test.mjs
new file mode 100644
index 000000000..386cd47af
--- /dev/null
+++ b/.github/scripts/derive-release-stamp.test.mjs
@@ -0,0 +1,240 @@
+import { describe, expect, test } from 'vitest';
+import {
+ deriveReleaseStamp,
+ formatOutputLines,
+ parseReleaseTag,
+ previousStableTag,
+} from './derive-release-stamp.mjs';
+
+// The real tag sequence around the measured mis-stamps, read off the mirror.
+// Note that v0.36.0 was cut BEFORE the v0.35.2-v0.35.6 point releases; version
+// order and cut order genuinely disagree here, which is what made the predicted
+// identity unsafe in the first place.
+const TAGS = [
+ 'v0.35.0',
+ 'v0.35.1',
+ 'v0.35.2',
+ 'v0.35.3',
+ 'v0.35.4',
+ 'v0.35.5',
+ 'v0.35.6',
+ 'v0.36.0',
+ 'v0.42.0',
+ 'v0.43.0',
+ 'v0.43.1',
+ 'v0.44.0',
+ 'v0.45.0',
+ 'v0.45.1',
+ 'v0.45.2',
+ 'v0.45.3',
+ 'v0.45.4',
+ 'v0.45.5',
+ 'v0.46.0',
+ // Betas share the namespace and must never be mistaken for a stable boundary.
+ 'v0.45.4-beta.1',
+ 'v0.46.0-beta.1',
+ 'v0.46.0-beta.2',
+ 'v0.46.0-beta.3',
+];
+
+const noPreviousTag = () => null;
+
+describe('parseReleaseTag', () => {
+ test('a beta keeps its prerelease suffix in the release identity', () => {
+ expect(parseReleaseTag('v0.46.0-beta.3')).toEqual({
+ channel: 'beta',
+ version: '0.46.0-beta.3',
+ name: 'v0.46.0-beta.3',
+ });
+ });
+
+ test('a stable yields the bare version', () => {
+ expect(parseReleaseTag('v0.46.1')).toEqual({
+ channel: 'stable',
+ version: '0.46.1',
+ name: 'v0.46.1',
+ });
+ });
+
+ test('a beta identity is never the bare base version', () => {
+ // The defect being fixed: `${TAG#v}` then `${V%%-beta.*}` collapsed every
+ // beta of a cycle onto a predicted stable that had not been computed yet.
+ for (const tag of ['v0.46.0-beta.1', 'v0.46.0-beta.2', 'v0.46.0-beta.3']) {
+ expect(parseReleaseTag(tag).version).not.toBe('0.46.0');
+ }
+ // ...and distinct betas stay distinct rather than collapsing together.
+ const versions = ['v0.46.0-beta.1', 'v0.46.0-beta.2', 'v0.46.0-beta.3'].map(
+ (t) => parseReleaseTag(t).version,
+ );
+ expect(new Set(versions).size).toBe(3);
+ });
+
+ test('double-digit prerelease counters parse', () => {
+ expect(parseReleaseTag('v0.46.0-beta.12').version).toBe('0.46.0-beta.12');
+ });
+
+ test.each([
+ ['nonsense'],
+ [''],
+ ['0.46.0'],
+ ['v0.46'],
+ ['v0.46.0-rc.1'],
+ ['v0.46.0-beta'],
+ ['v0.46.0-beta.x'],
+ ])('refuses %j rather than guessing an identity', (bad) => {
+ expect(() => parseReleaseTag(bad)).toThrow();
+ });
+});
+
+describe('previousStableTag', () => {
+ test('skips betas to find the previous production boundary', () => {
+ // v0.45.4-beta.1 sits between them and must not be chosen.
+ expect(previousStableTag({ tags: TAGS, tag: 'v0.45.5' })).toBe('v0.45.4');
+ });
+
+ test('orders numerically, not lexicographically', () => {
+ const tags = ['v0.9.0', 'v0.10.0', 'v0.11.0'];
+ // A string sort would put v0.9.0 above v0.10.0 and pick the wrong bound.
+ expect(previousStableTag({ tags, tag: 'v0.11.0' })).toBe('v0.10.0');
+ expect(previousStableTag({ tags, tag: 'v0.10.0' })).toBe('v0.9.0');
+ });
+
+ test('reaches the previous stable across a whole beta cycle', () => {
+ // The range a stable promotion must scan: everything since the last stable,
+ // not merely since the most recent beta.
+ expect(previousStableTag({ tags: TAGS, tag: 'v0.46.0' })).toBe('v0.45.5');
+ });
+
+ test('returns null for the first stable ever', () => {
+ expect(previousStableTag({ tags: ['v0.1.0'], tag: 'v0.1.0' })).toBeNull();
+ expect(previousStableTag({ tags: [], tag: 'v0.1.0' })).toBeNull();
+ });
+
+ test('ignores non-release refs sharing the v* namespace', () => {
+ const tags = ['v0.45.4', 'vendor-snapshot', 'v0.45.4-beta.9', 'v0.45.5'];
+ expect(previousStableTag({ tags, tag: 'v0.45.5' })).toBe('v0.45.4');
+ });
+
+ test('refuses to answer for a beta tag', () => {
+ // Betas take the describe-based bound; asking here would silently return a
+ // production boundary for a non-production cut.
+ expect(() => previousStableTag({ tags: TAGS, tag: 'v0.46.0-beta.1' })).toThrow();
+ });
+});
+
+describe('deriveReleaseStamp', () => {
+ test('a beta scans only its own new commits', () => {
+ expect(
+ deriveReleaseStamp({
+ tag: 'v0.46.0-beta.3',
+ tags: TAGS,
+ describePreviousTag: () => 'v0.46.0-beta.2',
+ }),
+ ).toEqual({
+ channel: 'beta',
+ version: '0.46.0-beta.3',
+ name: 'v0.46.0-beta.3',
+ baseRef: 'v0.46.0-beta.2',
+ });
+ });
+
+ test('a stable scans back to the previous stable, ignoring describe', () => {
+ const stamp = deriveReleaseStamp({
+ tag: 'v0.46.0',
+ tags: TAGS,
+ // `git describe` would answer with the nearest beta; the stable path must
+ // not consult it, or the promotion would miss earlier betas' tickets.
+ describePreviousTag: () => 'v0.46.0-beta.3',
+ });
+ expect(stamp.baseRef).toBe('v0.45.5');
+ expect(stamp.channel).toBe('stable');
+ });
+
+ test('the first tag ever yields an empty bound rather than a wrong one', () => {
+ expect(
+ deriveReleaseStamp({
+ tag: 'v0.1.0-beta.1',
+ tags: [],
+ describePreviousTag: noPreviousTag,
+ }).baseRef,
+ ).toBeNull();
+ });
+
+ test('a malformed tag fails loud before any git work', () => {
+ expect(() =>
+ deriveReleaseStamp({
+ tag: 'not-a-tag',
+ tags: TAGS,
+ describePreviousTag: () => {
+ throw new Error('describe must not run for an unparseable tag');
+ },
+ }),
+ ).toThrow(/unrecognized release tag/);
+ });
+});
+
+describe('formatOutputLines', () => {
+ test('an absent lower bound emits an EMPTY base_ref, not a placeholder', () => {
+ // The sync action reads empty as "use your own default". A placeholder such
+ // as HEAD would narrow a first-ever scan to nothing.
+ const lines = formatOutputLines({
+ channel: 'beta',
+ version: '0.1.0-beta.1',
+ name: 'v0.1.0-beta.1',
+ baseRef: null,
+ });
+ expect(lines).toContain('base_ref=');
+ expect(lines.some((l) => l.startsWith('base_ref=') && l.length > 'base_ref='.length)).toBe(
+ false,
+ );
+ });
+
+ test('emits every key the workflow steps read', () => {
+ expect(
+ formatOutputLines({
+ channel: 'stable',
+ version: '0.46.1',
+ name: 'v0.46.1',
+ baseRef: 'v0.45.5',
+ }),
+ ).toEqual(['channel=stable', 'version=0.46.1', 'name=v0.46.1', 'base_ref=v0.45.5']);
+ });
+});
+
+describe('regressions from the measured mis-stamps', () => {
+ // Each case is a real attachment that landed on the wrong release because the
+ // identity came from a predicted stable version instead of the cut tag.
+ test.each([
+ // A beta cut that predicted 0.42.0; the fix actually shipped in v0.43.0.
+ ['v0.42.0-beta.1', '0.42.0-beta.1', 'v0.41.4'],
+ // Predicted 0.43.0; actually shipped in v0.45.0.
+ ['v0.43.0-beta.2', '0.43.0-beta.2', 'v0.43.0-beta.1'],
+ // Predicted 0.45.5; actually shipped in v0.46.0.
+ ['v0.45.5-beta.1', '0.45.5-beta.1', 'v0.45.4'],
+ // Each `expected` is deliberately NOT the stripped stable base that the old
+ // `${V%%-beta.*}` expansion produced, which is what mis-attributed these.
+ ])('%s stamps its own tag, not the predicted stable', (tag, expected, previous) => {
+ const stamp = deriveReleaseStamp({
+ tag,
+ tags: TAGS,
+ describePreviousTag: () => previous,
+ });
+ // Pin the whole shape: the fix is both the identity AND the scan boundary,
+ // and asserting only the version would let a broken bound through.
+ expect(stamp).toEqual({
+ channel: 'beta',
+ version: expected,
+ name: tag,
+ baseRef: previous,
+ });
+ });
+
+ test('a point release bounds on its immediate stable predecessor', () => {
+ // The 0.45.x point releases form a chain. Each must bound on the one before
+ // it, so its scan covers only what it actually adds — not the whole 0.45
+ // line back to the minor.
+ expect(previousStableTag({ tags: TAGS, tag: 'v0.45.4' })).toBe('v0.45.3');
+ expect(previousStableTag({ tags: TAGS, tag: 'v0.45.3' })).toBe('v0.45.2');
+ expect(previousStableTag({ tags: TAGS, tag: 'v0.45.1' })).toBe('v0.45.0');
+ });
+});
diff --git a/.github/workflows/linear-release.yml b/.github/workflows/linear-release.yml
index f1a331441..9fef40f02 100644
--- a/.github/workflows/linear-release.yml
+++ b/.github/workflows/linear-release.yml
@@ -3,12 +3,14 @@ name: Linear Release
# Stamp Linear issues with the Open Knowledge release they ship in.
#
# WHAT THIS DOES
-# On every OK release cut (beta cadence + stable promotion) this attaches
-# the Linear issues referenced in the release's commits to a release in the
-# Linear "OpenKnowledge" scheduled pipeline, and advances that release's
-# stage to `Beta` on a beta cut, then completes it on a stable promotion.
-# Each attached issue then shows which release it shipped in, in its Linear
-# sidebar. Uses Linear's first-party CLI via linear/linear-release-action.
+# On every OK release cut (beta cadence + stable promotion) this attaches the
+# Linear issues referenced in the release's commits to a release in the Linear
+# "OpenKnowledge" scheduled pipeline. A beta cut advances ITS OWN release to
+# the `Beta` stage; a stable promotion completes ITS OWN release into
+# `Released`. They are two different release objects, not one advanced then
+# completed — see RELEASE IDENTITY below. Each attached issue then shows both
+# the beta and the stable it shipped in, in its Linear sidebar. Uses Linear's
+# first-party CLI via linear/linear-release-action.
#
# HOW IT'S TRIGGERED (no edits to the delicate publish path)
# release.yml (beta) and promote-stable.yml (stable) BOTH already fire a
@@ -30,19 +32,31 @@ name: Linear Release
# started stage: `complete` moves the release straight past it, so nothing
# would ever rest there.
#
-# RELEASE IDENTITY (why betas accumulate into one release)
-# The Linear release is keyed by the STABLE base version (vX.Y.Z with any
-# `-beta.N` stripped), so every beta of a cycle syncs its issues into the
-# SAME release object, and the stable promotion completes that same release.
-# Caveat: if a higher bump level lands mid-cycle the base
-# version shifts; that is rare, and Linear releases can be renamed/merged.
+# RELEASE IDENTITY (the tag is used verbatim)
+# A cut stamps the release named by its OWN tag: `v0.46.0-beta.3` keys the
+# release `0.46.0-beta.3`, and the stable promotion keys `0.46.1`. A ticket
+# therefore ends up on two releases — the beta it first shipped in, and the
+# stable that shipped it.
+#
+# This used to strip `-beta.N` and key every beta of a cycle onto the
+# remaining X.Y.Z. That number is a PREDICTION made at cut time; the real
+# stable version is computed later at promote time against a delta that has
+# moved. Keying on it attributed tickets to versions that never carried them,
+# always in the same direction (too early). A tag's own name cannot be wrong.
#
# COMMIT SCAN RANGE
-# The scan lower bound (base_ref) is the previous tag in history, so each cut
-# only scans its own new commits (`<prev-tag>..<this-tag>`) — bounded even on
-# the first run. sync is idempotent: re-attaching an already-attached issue
-# is a no-op, so a near-empty stable range simply re-affirms the accumulated
-# set before the stage flip.
+# The lower bound depends on the channel, because the two releases answer
+# different questions:
+# beta -> previous tag of any kind, so the beta holds what is NEW in it
+# and a ticket lands on the beta it FIRST shipped in.
+# stable -> previous STABLE tag, skipping betas. A promotion batches every
+# changeset since the last stable, so stopping at the most recent
+# beta would miss every ticket from earlier betas in the cycle.
+# sync is idempotent, so a re-run simply re-affirms an already-attached set.
+#
+# Both derivations live in .github/scripts/derive-release-stamp.mjs with a
+# colocated test suite. They are NOT inline shell: this workflow shipped a
+# wrong-version defect that untested `${VAR%%...}` expansion made invisible.
#
# ONE-TIME SETUP
# 1. A Linear SCHEDULED pipeline "OpenKnowledge" (team Product) with exactly
@@ -84,8 +98,10 @@ permissions:
contents: read
concurrency:
- # Serialize per release line so a beta and its stable promotion don't race
- # on the same Linear release object.
+ # Serialize re-runs of the SAME tag, so a manual workflow_dispatch cannot
+ # overlap a still-running dispatch-triggered stamp of that tag. A beta and its
+ # stable no longer need serializing against each other: they key different
+ # tags, and therefore different Linear release objects.
group: linear-release-${{ github.event.client_payload.release_tag || inputs.release_tag }}
cancel-in-progress: false
@@ -113,42 +129,22 @@ jobs:
fetch-depth: 0
fetch-tags: true
+ - name: Set up Node
+ if: env.HAS_KEY == 'true'
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
+ with:
+ node-version: "24"
+
+ # The script has no dependencies beyond node: builtins, so there is
+ # nothing to install between setup and this call.
- name: Derive channel, version, and scan range
if: env.HAS_KEY == 'true'
id: derive
- run: |
- set -euo pipefail
- TAG="${RELEASE_TAG}"
- if [[ -z "$TAG" ]]; then
- echo "::error::No release tag (neither client_payload.release_tag nor inputs.release_tag)."
- exit 1
- fi
- # Stable base version: strip leading `v` and any `-beta.N` suffix.
- V="${TAG#v}"; V="${V%%-beta.*}"
- if [[ ! "$V" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- echo "::error::Could not derive X.Y.Z from tag '${TAG}'."
- exit 1
- fi
- if [[ "$TAG" == *-beta.* ]]; then
- CHANNEL=beta
- else
- CHANNEL=stable
- fi
- # Exclusive lower bound for sync's commit scan = the previous tag in
- # history. Empty on the very first tag ever; the action then falls
- # back to its own default lower bound.
- BASE_REF="$(git describe --tags --abbrev=0 "${TAG}^" 2>/dev/null || true)"
- {
- echo "channel=${CHANNEL}"
- echo "version=${V}"
- echo "name=v${V}"
- echo "base_ref=${BASE_REF}"
- } >> "$GITHUB_OUTPUT"
- echo "tag=${TAG} channel=${CHANNEL} version=${V} base_ref=${BASE_REF:-<none>}"
+ run: node .github/scripts/derive-release-stamp.mjs "${RELEASE_TAG}"
- # Create/find the release keyed by the stable version, name it vX.Y.Z,
- # and attach the Linear issues referenced in <base_ref>..HEAD. Runs on
- # both channels; idempotent.
+ # Create/find the release keyed by this cut's own tag and attach the
+ # Linear issues referenced in <base_ref>..HEAD. Runs on both channels;
+ # idempotent.
- name: Sync issues into the Linear release
if: env.HAS_KEY == 'true'
uses: linear/linear-release-action@c0cb8354a362c24c6d3e0948f37fd66d07588e3f # v0
@@ -163,6 +159,12 @@ jobs:
# promotion has no started-stage step — reaching stable IS completion, so
# the `complete` step below moves the release straight to the completed
# `Released` stage (two-channel model: stable = production = done).
+ #
+ # A beta release RESTS in `Beta` and is never completed: it is a historical
+ # record of a beta cut, and the stable that supersedes it is a separate
+ # release object with its own identity. So the two stages partition the
+ # pipeline cleanly — `Beta` holds every beta ever cut, `Released` holds
+ # every stable. Nothing is left half-finished.
- name: Advance to Beta stage (beta cut)
if: env.HAS_KEY == 'true' && steps.derive.outputs.channel == 'beta'
uses: linear/linear-release-action@c0cb8354a362c24c6d3e0948f37fd66d07588e3f # v0