Repository navigation
ci(release): publish prereleases to npm next and as GitHub prereleases - #36
Merged
Merged
Conversation
The release workflow had no notion of a prerelease. A v0.4.0-rc.1 tag would have run `npm publish` with no --tag. npm 11 refuses that for a prerelease version; older npm tags it `latest`. The GitHub release would also have been created as a regular latest release. scripts/release/release-plan.js now derives the channel from the version alone: - 0.4.0 is stable: npm `latest`, GitHub release marked latest. - -rc.N, -beta.N and -alpha.N are prereleases: npm `next`, GitHub prerelease, make_latest false. - Any other version is refused. A prerelease also needs docs/releases/v<version>.md, which becomes the release body. plan job (runs first): - Keeps the PR #33 guard and widens it: the tag must match Cargo.toml, every Cargo.lock workspace entry, all six npm manifests and the five platform pins. build job: - Binaries on runnable targets must report the tag's version. publish job: - Re-checks the plan and refuses incomplete staged binaries. - Passes an explicit --tag to every `npm publish`. Platform packages go first; the main package goes only once every platform package it pins is on the registry. - Skips versions already published, so a failed run can be re-run. - Afterwards waits out registry lag and checks that the dist-tag points at the version and, for a prerelease, that `latest` did not move. - No longer rewrites versions; the tree must already carry them. Pinned: - Every action to a commit SHA. - Rust 1.100.0 and Node 24.22.3. - `npm install -g npm@latest` removed: that is now npm 12. Node 24.22.3 bundles npm 11.19.1, which supports trusted publishing. - cross to a revision and its aarch64 image to a digest. - Runner labels to ubuntu-24.04 and windows-2025-vs2026. - No build cache in the binary job. Re-runs and gates: - Artifacts are kept 7 days instead of 1, so failed jobs can be re-run. - The registry wait is about 5 minutes. - The tag must be on main (every earlier tag is). - setup-node runs on every build runner. Permissions: - Top-level permissions are contents: read. - Only publish-npm has id-token: write. - The GitHub release moves to its own job, the only one with contents: write. bump-version.js: - Rejects malformed versions. - Replaces a prerelease version in Cargo.toml; the old [\d.]+ pattern left 0.4.0-rc.1 in place when bumping to 0.4.0. - Updates the Cargo.lock workspace entries. - Verifies the result. Testing: - 26 node:test cases: stable, rc, beta, alpha, malformed and mismatched versions, publish order, dist-tags, retries, registry lag, the latest-moved check, the bump round trip, the plan CLI outputs, and workflow pinning. - They run in CI's web job.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
release.ymlhad no notion of a prerelease. Av0.4.0-rc.1tag would have runnpm publishwith no--tag:latest.npm@latest, which is now npm 12, so the behaviour was not even fixed.The GitHub release would also have been a regular "latest" release. This was risk #10 in the v0.4.0 gate: "do not push rc tags". Merge this before the RC PR, and before any rc tag.
What
scripts/release/release-plan.jsderives the channel from the version alone:0.4.0latest0.4.0-rc.N,-beta.N,-alpha.Nnextmake_latest: falseplan job (runs first):
main.Cargo.toml, everyCargo.lockworkspace entry, all six npm manifests and the five platform pins. This widens the ci(release): refuse a tag that does not match the committed version #33 guard.docs/releases/v<version>.md, which becomes the release body ahead of the generated notes.build job: binaries the runner can execute (darwin-arm64, linux-x64, win32-x64) must print the tag's version.
publish job:
--tagand--provenanceto every publish. Platform packages go first; the main package goes only after every platform it pins is visible on the registry.latestmoved, and prints thenpm dist-tag addcommand to restore it.Pinned:
1.100.0and Node24.22.3. Node 24.22.3 bundles npm 11.19.1, which supports trusted publishing, so thenpm@latestinstall is gone.crossto a revision and its aarch64 image to a digest. That image is today'smain, which needs glibc ≥ 2.39, the same floor as v0.3.3's arm64 binary.ubuntu-24.04andwindows-2025-vs2026.Permissions:
contents: read.publish-npmhasid-token: write.contents: write.Re-runs and concurrency: artifacts are kept 7 days, and a concurrency group allows one run per tag.
scripts/bump-version.js:0.4.0-rc.1→0.4.0used to leave Cargo at rc.1 while npm moved.CONTRIBUTING: new "Releasing" section, including moving
nextafter a stable release.Testing
node:testcases, run in CI'swebjob, so the job count stays 13. They cover:--tag, mapping rc to latest, removing the latest-moved check, publishing main before platforms, skipping the Cargo.lock check, and accepting build metadata each fail the tests.actionlintis clean.plan --tag v0.4.0-rc.1givesnext/ prerelease.publish --dry-runpublishes all six packages "with tag next".v0.4.0on the rc tree,v0.4.0-rc.2,v0.4.0-RC.1and a tag withoutvare refused.latest: 0.3.3, nonext).