[cd] Support non-LTS releases (#99948)
#99807 replaced versioned release branches with the fixed
`releases/lts/active` + `releases/lts/maintenance` refs. This PR builds
the complete story for releases that do not fit those two branches, in
four parts:
**1. Purely version-based LTS ref adjustment** (revises the routing
merged in #99807)
`updateLtsBranchRefs` no longer looks at `semverType` at all. After a
stable release it compares only the released version
(`readReleaseVersion()`) against npm, and it never matters which branch
or tag the release was dispatched from:
- released version starts a **new major** → `releases/lts/maintenance`
takes `releases/lts/active`'s position, then `releases/lts/active` moves
to the new tag
- on the **latest published major** (npm `latest`) and newer than
everything published in that line → `releases/lts/active` moves to the
new tag
- on the **previous major** and newer than everything published in that
line → `releases/lts/maintenance` moves to the new tag
- anything else (older versions, prerelease channels) → no refs move
The "newer than everything published in that line" check resolves the
caret range of the released version against npm (equivalent to `npm view
next@^<version> version`), doubling as a no-rewind guard: an errant
release cut on an old line (e.g. 15.5.0 while 15.7.x is published)
cannot drag a branch backwards. This also fixes the gap the old
patch-does-nothing rule had: releasing 16.5.0 from the
`v16.5.0-canary.1` tag while canary sits at `16.5.0-canary.2` moves
`active` as it should.
**2. Tag-dispatched (detached HEAD) releases**
Dispatching `Trigger Release` on a tag — e.g. cutting a stable version
from an older canary tag — performs a tag-only release: the signed
release commit lives only on the new tag and pushes no branch; the
version-based rules above then move the LTS refs exactly as for any
other dispatch. The tag push drives `build_and_deploy` as usual, and
`sync_backport_canary_release` advances canary afterwards when the
release is semver-ahead of it. (Dispatching on a tag runs the tag's own
workflow and scripts, so this takes effect for tags cut after this
lands; pre-existing `next-*` branches remain usable for older lines in
the meantime.)
**3. Zero-setup branches for changes based on older tags**
A tag-only release cannot carry changes, so a fix for an older line
(e.g. 15.4.x once 15.x has moved on) gets a branch. The name is
functionally irrelevant — by convention we keep the old
`next-<major>-<minor>` pattern — and any maintainer can create it with
no workflow and no setup commit, because publishing is gated on
bot-created tags, not on branches:
```bash
git push origin v15.4.8^{commit}:refs/heads/next-15-4
```
The `build_and_test.yml` / `build_and_deploy.yml` push filters include
`next-*-*`, and the staging deploy-target condition globs
`refs/heads/next-*-*`, so CI and the pre-publish build run on pushes
automatically. Backport the fix, dispatch `Trigger Release` (stable,
`patch`) on the branch, and the bot-created tag drives the publish; no
LTS refs move since newer versions of that major are already published.
**4. `scripts/release-branches.json` removed**
Its only consumer was the `version-bump.js` branch gate
(`assertBranchIsAllowed` / `--allow-branch`), which protected nothing
the publish path doesn't already protect: tags are bot-only, real
releases run through the workflow's app credentials, and the gate read
per-branch content so it could never stop a determined actor. The gate,
the flag, and the bypass call sites in `start-release.js` /
`set-preview-version.js` are gone.
Docs and the `backport-pr` skill describe the new model: LTS branches by
default, a "Releases based on older tags" section covering both flows
(branch + backport + dispatch for changes, tag dispatch for no-change
one-shots).
## Verification
All as `node ./scripts/start-release.js --release-type <t> --semver-type
<s> --dry-run` (mock client, zero API calls):
- attached **patch** (16.5.0 > npm latest 16.4.0) → `PATCH
refs/heads/releases/lts/active` to the tag SHA
- attached **minor** → same move; attached **major** → `maintenance`
move (active's pre-move tip) before the `active` move
- attached **canary** → zero LTS ref API calls
- **detached** patch (the canary.1 scenario) → tag-only release (no
branch PATCH from the release commit) **plus** the `releases/lts/active`
move
---------
Co-authored-by:
Claude Code <noreply@anthropic.com>
Showing
This diff is collapsed.
Please
register
or
sign in
to comment