Skip to content

Stage the npm launcher for approval instead of publishing it - #47

Merged
tauanbinato merged 1 commit into
mainfrom
npm-staged-publish
Sep 28, 2026
Merged

tauanbinato merged 1 commit into
mainfrom
npm-staged-publish

Conversation

@tauanbinato

Copy link
Copy Markdown
Contributor

npm's trusted publisher settings advise against letting a workflow run npm publish: "For stronger security, leave this unchecked to require staged publishing for new versions." The package's trusted publisher now allows only npm stage publish, so #46's job would be refused. With this change the release job stages each version, and the version goes live when the maintainer approves it on npmjs.com (the package's Staged Packages) or with npm stage approve <stage-id>, with their second factor. The release job, or anyone who takes over its OIDC token, can no longer put a version live alone.

  • Staged publishing needs npm 11.15.0 or later, so the job installs npm 11.20.0 (whose engines accept Node 24) instead of taking the one Node brings, and checks the version before staging.
  • npm stage publish ./npm --access public --provenance; a notice in the run says the version is waiting for approval. A dry run of the same command on npm/ with npm 11.20.0 packed the 4 files and stopped only because 0.30.0 is already published.
  • A rerun still skips a version npm has published. One staged and not yet approved stops a rerun with npm's error, since npm refuses to stage a version twice.
  • actionlint passes; the job first runs on the next tag.

npm's trusted publisher settings advise against letting a workflow run
npm publish: allowed only npm stage publish, a release's version waits on
npmjs.com until the maintainer approves it with their second factor, so
the release job, or anyone who takes over its token, cannot put a version
live alone.

Staging needs npm 11.15.0 or later, so the job installs npm 11.20.0
rather than take the one Node brings, checks it, and runs npm stage
publish with provenance. A notice in the run says the version is waiting
for approval. A rerun still skips a version npm has published; one staged
and not yet approved stops it, as npm refuses to stage a version twice.
@tauanbinato
tauanbinato merged commit fc48302 into main Sep 28, 2026
12 checks passed
@tauanbinato
tauanbinato deleted the npm-staged-publish branch September 28, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant