Repository navigation
fix(ci): choose a release's dist-tag when it publishes, and move next after it - #3794
armando-navarro wants to merge 2 commits into
Conversation
… after it A stable tag published to latest unconditionally, so a 20.x release tagged after 21.0.0 would move latest back to 20.x. A stable release now goes to latest only when it ranks above npm's latest and every other stable git tag, since a higher release can still be in npm's publish-time malware scan. Otherwise it goes to v<major>-lts, and the job fails if it does not rank above that tag or another release of its major. Every publish now waits until npm lists it, in one npm-publish queue, so the next publish reads the real dist-tags. That stops a queued canary from reading a stale canary tag. After a release reaches latest, next moves up to it, and a failure there prints the npm dist-tag command that finishes it. A re-run of a published release skips npm publish and goes on to the wait and the next move. The steps live in tools/publish-job.js and tools/release-tag.js so specs cover them, and build.sh no longer picks a tag.
The check that skips a canary of an earlier commit keeps the same decisions and messages, and its specs now cover each branch. It runs only for pushes and scheduled runs, and a failed read of npm's dist-tags now says why.
tyler-reitz
left a comment
There was a problem hiding this comment.
LGTM. Two notes on the description, nothing on the code.
The specs hold up under mutation. Five targeted breaks each go red and the baseline stays green: dropping the prerelease tiebreak in isAbove (4 failures), renaming the lts tag (8), dropping the STABLE guard in movesNext (1), never setting listed in the wait step (1), and skipping the already-published shortcut (1). I also ran releaseTag over ten realistic scenarios, including both refusal paths and v-prefixed tags, and all of them land where the rules say.
The npm dist-tag add step authenticates, since setup-node points registry-url at the wombat host and the step carries the token. The canary-check refactor keeps all four messages identical, with ::error:: now applied centrally by runStep instead of inline, and swapping the *-canary.* guard for github.event_name != 'release' is equivalent, because every non-release run of this job is on main, where build.sh always builds a canary.
Note 1: the re-runs bullet is narrower than it reads. publishedUnder('21.0.0-rc.1', {latest: '21.0.0', next: '21.0.0'}) is undefined, so re-running an old prerelease's job after next has moved on takes the publish path and fails on the existing version rather than skipping.
Note 2: releasesAbove does not guard a missing distTags.latest, unlike blocking and movesNext. releaseTag('21.0.0', {}, ['21.0.0']) throws undefined is not a semver version. Unreachable for a published package, and throwing is right, so this is only about the message.
Fixes #3790
Fixes #3791
The publish job now picks a release's dist-tag when it publishes, moves
nextup after a stable release, and waits until npm lists each publish before the next one starts.Changes
The first commit moves the publish job's new steps into
tools/publish-job.jsand the version rules intotools/release-tag.js, each with a spec.latestonly if it ranks above npm'slatestand every other stable git tag. Git tags count because a higher release can still be in npm's publish-time scan.v<major>-lts, the name Angular uses for its own older majors.v<major>-lts, or above another stable release of its own major.next, as before.npm publish, the job polls npm's dist-tags every 15 seconds for up to 20 minutes.npm-publishconcurrency group, so the next publish starts only after the wait.latest, the job fails and prints the command that movesnext.next.latest, the job runsnpm dist-tag add @angular/fire@<version> nextthrough the publishing proxy whennextis lower.npm publishand continues with the wait and thenextmove.tools/build.shonly sets the version now. The publish step passes the tag tonpm publish, sopublish.shis gone.The second commit moves the existing canary check from #3784 into
tools/publish-job.js, with the same decisions and messages, and runs it only for pushes and scheduled runs.Behavior to know
20.1.xneeds this change before its next release, or that release still publishes tolatest. A separate PR will bring it there.20.0.xgets no further releases.nextmove has not run for this repository before. The first release after this merges is its first real run. If it fails, the job prints the command to run by hand.next, even below its current value.canary-publishtonpm-publish, so a canary still queued under the old name when this merges is not ordered with the first run under the new one.Verification
npm run test:node: 381 specs, 0 failures. The new specs cover:semverover 50 version pairsgitand$GITHUB_OUTPUTcalls, against a local repositorymainand on releases.