feat: add publish-npm.yml for npm stable releases - #62
Conversation
|
Warning Review limit reachedNext included review available in 40 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
4bf1d6b to
f9848e9
Compare
Code Review ResultsScope: merge-base 380f772 →
P2 -- Moderate
P3 -- Low
Coverage
|
|
Force-pushed review fixes (now f9848e9), folded into the two commits. Both commits pass all
|
Summary
Adds
publish-npm.ymlfrom the v1 interface plan (issue 49), replacing the fiverelease.ymlcopies in the npm repositories (issue 29). With the release pipeline from PR 61, an npm repository'smain.ymlcallsrelease-versionandstage-release, and itsrelease.ymlcallspublish-npm.Behaviour
Two jobs keep dependency code away from publish credentials:
build, withoutid-token: requires a release event and a release commit on the default branch; checks the tag isv<upstream>+<N>with<upstream>equal to VERSION, and VERSION equal topackage.json; skips with a warning when the version is already on npm; otherwise installs with--ignore-scripts(npm ci, ornpm installwith a warning when there is no lockfile), runsprepublishOnly, packs, and uploads the tarball.publish, withid-token: write: requires npm 11.5.1 or later, downloads the tarball, and runsnpm publish <tarball> --ignore-scripts. It serializes in the concurrency group<repository>-publish-npm-job.Compared with the five copies: all skipped pre-releases; one read the package name from
package.json(four hardcoded it); two checked VERSION againstpackage.json; four warned on an existing version; one setpersist-credentials: false; four serialized publishes. New here: the default-branch check, the tag-vs-VERSION check, and publishing a prebuilt tarball from a job that runs no dependency code. The corepack step all five copies had never took effect (runs printPreparing npm@11.14.1and then11.17.0), so it is gone.Trusted publishing
npm validates the calling workflow's filename, so each repository keeps
.github/workflows/release.ymland its npm trusted publisher configuration does not change. The caller grantsid-token: writeon the calling job, asexamples/npm/.github/workflows/release.ymlshows (npm docs).Verification
tests/publish-npm.test.shruns extracted steps against a fakenpmand throwaway repositories: new and existing versions,v-prefixed VERSION, VERSION andpackage.jsonmismatch, tag for another version, malformed tags, release commit on and off the default branch, npm version minimum.Closes #53
🤖 Generated with Claude Code