npm staged publishing landed in CLI 11.15.0 on May 22, 2026. Adopting it in CI is two-line work for simple repos and a small project for monorepos. The migration plan from npm publish to npm stage publish, with the changes release automation expects.
Why Bother
npm shipped staged publishing on May 22, 2026, as a generally-available feature in npm CLI 11.15.0. The mechanic is simple: npm publish puts a package live; npm stage publish puts the package in a staging queue, where a human maintainer with a 2FA challenge must approve it before it goes live.
A stolen automation token can call npm stage publish. It cannot complete the approval. After the Shai-Hulud, TeamPCP, TanStack, and RubyGems supply chain attacks of the last six months, that single asymmetry is the cheapest meaningful supply chain defense available to any package maintainer.
The feature is opt-in. Until you change CI, your packages publish exactly as before. This article is the migration plan.
The Minimum Change For A Single-Package Repo
A typical GitHub Actions publish step:
- name: Publish to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Migrate by changing one word:
- name: Stage publish to npm
run: npm stage publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
After the CI job succeeds, the package version sits in the staging queue. A maintainer opens npmjs.com (or runs npm stage list locally), reviews the staged version, and approves it:
npm stage approve my-pkg@1.4.2
# Interactive 2FA prompt
That is the full minimum migration. Two lines of CI changes, plus a person with a phone or hardware key to finalize the publish.
Add Trusted Publishing And Stage-Only Mode
The minimum migration leaves one gap: a direct npm publish call from anywhere (CI accidentally, a developer locally) still bypasses the staging queue. To close that gap, enable trusted publishing (OIDC-based authentication, no long-lived tokens) and configure the package as stage-only.
Set up trusted publishing through the npm web UI for your package:
- Configure a trusted publisher for your package on npmjs.com, pointing at your GitHub Actions workflow.
- Remove the long-lived NPM_TOKEN from your GitHub Actions secrets. The OIDC integration replaces it.
- Flip the package to stage-only in the npmjs.com publisher settings. Direct
npm publishis now rejected at the registry.
The updated workflow looks like:
- name: Authenticate with npm via OIDC
uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
- name: Stage publish to npm
run: npm stage publish --access public --provenance
No NPM_TOKEN anywhere in the workflow. No long-lived secret to steal. Every publish is OIDC-authenticated, attestation-signed, and gated by a human 2FA approval.
This is the configuration you want every maintainer of a high-impact package to reach by the end of the quarter.
Monorepo Adoption (Changesets, Lerna, Nx, Turborepo)
A monorepo that publishes 12 packages per release becomes 12 approvals when each one is staged. There is no built-in bulk approve UX yet. The practical options:
Option A: Approve each one in the npmjs.com web UI. Acceptable for small releases. Painful for large ones.
Option B: Stage from CI, approve from a local script that loops npm stage approve with the 2FA prompt firing once per call:
#!/bin/bash
for pkg in $(npm stage list --json | jq -r '.[].name'); do
echo "Approving $pkg..."
npm stage approve "$pkg"
done
This works but is interactive-only. Each approval call asks for a 2FA code. With hardware-key 2FA this is fast. With TOTP and 12 packages it is fifteen seconds of typing.
Option C: Limit staged publishing to your high-impact packages. Not every package in a monorepo is equally critical. A monorepo with two customer-facing packages and ten internal-shared packages can stage-publish the two and direct-publish the ten. Configure stage-only on the critical packages only.
For most teams shipping 1 to 4 customer-facing packages from a monorepo, Option C plus Option B for the staged subset is the right balance.
Release Tooling Adjustments
Automated release tools each have a small adjustment:
release-please. Out of the box release-please runs npm publish after merging the release PR. Override the publish command in your workflow:
- name: Stage publish via release-please
if: ${{ steps.release.outputs.release_created }}
run: npm stage publish --access public --provenance
semantic-release. Configure the @semantic-release/npm plugin with a pkgRoot and add a custom publish step in the GitHub Actions workflow. The plugin's default publish command can be replaced via a publishConfig step.
changesets. Add the stage step to the release script in package.json:
{
"scripts": {
"release": "changeset publish",
"release:staged": "changeset publish --no-git-tag && npm stage publish"
}
}
Or, more cleanly, use changesets to bump versions and write changelogs only, and add a separate workflow step that runs npm stage publish for each version-bumped package.
What Breaks And What Does Not
Adopting staged publishing breaks a few common assumptions.
Downstream consumers expecting the package live immediately after CI green. If your release notification (Slack, email, GitHub release) fires from the same workflow that calls npm stage publish, the notification arrives before the package is live. Move the notification to a post-approval workflow, or accept that "released to staging" and "released to npm" are two separate states.
npm view returning the new version. Until approval, npm view <pkg> versions does not show the staged version. Tools that poll for the new version need a slight delay or a manual trigger.
install --pre flag, pre-release tags, and dist-tags. Staging treats every dist-tag the same. A staged @beta publish still requires approval before the dist-tag updates.
What does not break:
- Existing installed versions. Anyone who already has the previous version installed sees no difference.
- Provenance. Staged publishes carry the provenance attestation, which transfers to the live version on approval.
- Download counters and stats. Staged versions are not counted until approved.
- Other registries. Staged publishing is npm-only. PyPI and Crates.io have their own evolving stories.
A Pre-Migration Local Test
Before flipping CI, do the migration locally on a throwaway test package:
# In a test project
npm version patch
npm stage publish --access public
# Verify the staged version
npm stage list
npm stage view test-pkg@1.0.1
# Approve and verify it goes live
npm stage approve test-pkg@1.0.1
npm view test-pkg version
Doing the dry run once on a real package answers a lot of "wait, how does this part work" questions before the CI migration locks in the new flow.
A Two-Week Adoption Plan
Realistic week-by-week:
Week 1
- Update CI runner images to npm 11.15.0 or later.
- Pick one high-impact package and migrate its workflow to
npm stage publish. - Document who on the team holds approval rights and what the approval response time is.
- Do one real release through the new flow.
Week 2
- Add trusted publishing OIDC to the migrated package.
- Flip stage-only mode on for that package.
- Remove the now-unused NPM_TOKEN secret.
- Add a second package to the migrated set.
- Write the approval runbook: who approves on weekdays, who approves during incidents, what the rollback procedure is.
Continue rolling out to additional packages on a one-per-week cadence. By the end of a quarter the package surface that justifies staged publishing is all migrated, and the long-lived token surface has shrunk meaningfully.
What Adoption Does Not Replace
Staged publishing closes one specific attack: stolen automation token publishes a poisoned version. It does not replace:
- Code review on the pull request that adds the publish.
- Dependency review and pinning for transitive supply chain risk.
- Secret scanning on the repository for credential leaks.
- 2FA on the npm account itself.
- Hardware-backed 2FA on critical maintainer accounts.
A team that adopts staged publishing without those is still exposed. Staged publishing is one layer of a defense-in-depth posture, not a replacement for the rest.
Bottom Line
Two lines of CI change, one OIDC configuration step, one stage-only flip, and one approval runbook. That is the full staged-publishing migration for a typical package. The asymmetry it produces (CI can stage, only a human can finalize) closes the cheapest mass-volume npm supply chain attack of the last year.
If your team is running a busy CI release pipeline and wants the migration done cleanly across all packages, with OIDC trusted publishing set up, stage-only enforcement configured, and the release-automation tooling adjusted in place, our CI/CD pipeline setup team handles exactly this kind of upgrade. The work is small. The defense it adds is meaningful.
Frequently asked questions
What is npm stage publish and which npm CLI version supports it?
Staged publishing is an npm feature, generally available since npm CLI 11.15.0 on May 22, 2026, in which npm stage publish places a package version in a staging queue. A human maintainer then has to pass a 2FA challenge to approve it before it goes live, while plain npm publish still puts a package live immediately. The feature is opt-in, so nothing changes until the CI workflow does.
How do I switch GitHub Actions from npm publish to npm stage publish?
For a single-package repo the change is one word in the publish step. Replace npm publish --access public with npm stage publish --access public and keep NODE_AUTH_TOKEN set from the NPM_TOKEN secret. After the job succeeds, the version waits in the staging queue until a maintainer approves it. CI runner images need npm 11.15.0 or later.
How do I approve a staged package version on npm?
Open the package on npmjs.com, or run npm stage list locally to see what is waiting, then approve the version with a command such as npm stage approve my-pkg@1.4.2. Approval triggers an interactive 2FA prompt, so a person with a phone or hardware key has to finish it. To inspect a staged version first, run npm stage view with the same name and version.
How do I stop a direct npm publish from bypassing staged publishing?
Enable trusted publishing and switch the package to stage-only. On npmjs.com, configure a trusted publisher that points at the GitHub Actions workflow, remove the long-lived NPM_TOKEN from the GitHub Actions secrets, and flip the package to stage-only in the publisher settings. The registry then rejects a direct npm publish. The workflow runs npm stage publish --access public --provenance with OIDC authentication and no stored token.
How do I use npm staged publishing in a monorepo with many packages?
Every staged package needs its own approval, so a release of 12 packages means 12 approvals, and there was no built-in bulk approve option as of May 2026. A local script can loop over npm stage list --json with jq and call npm stage approve for each name, answering one 2FA prompt per package. Another approach is to make only the customer-facing packages stage-only and direct-publish internal ones. For teams with 1 to 4 customer-facing packages, combining the two is the suggested balance.
Does npm stage publish work with release-please, semantic-release and changesets?
Each tool needs a small adjustment. With release-please, override the publish step so it runs npm stage publish --access public --provenance when steps.release.outputs.release_created is set. With semantic-release, configure the @semantic-release/npm plugin with a pkgRoot and add a custom publish step to the workflow. With changesets, the cleaner route is to let changesets bump versions and write changelogs, then run npm stage publish for each bumped package in a separate step.
Why is my new version missing from npm view after npm stage publish?
Staged versions are not live until a maintainer approves them, so npm view does not list them yet. Tools that poll for the new version need a delay or a manual trigger. Release notifications sent from the same workflow arrive before the package is live, so move them to a post-approval workflow or treat released to staging and released to npm as two separate states.
Does npm staged publishing stop supply chain attacks?
Staged publishing closes one specific attack, a stolen automation token publishing a poisoned version. The token can call npm stage publish but cannot complete the 2FA approval. Code review, dependency review and pinning, secret scanning, 2FA on the npm account and hardware-backed 2FA for critical maintainers are all still needed, because staged publishing is one layer of defense in depth.
Read how we handle it in Cloud & Server Management.
Related Articles
How to Move Off cPanel Without Breaking Mail
A web request that lands on the old server serves a slightly stale page. A message that lands on the old server sits in a mailbox the customer can no longer reach, and it never moves on its own. This is the migration order that keeps every message reachable throughout, with the inventory items that break silently, the TTL work that has to happen days ahead, repeated incremental imapsync passes across the cutover, and the authentication records that must travel with the mail. The DKIM private key does not come with the mailboxes, and that is the step most migrations discover afterwards.
Server & DevOpsHow to Do Canary Releases Without a Service Mesh
You can send five percent of production traffic at a new version, watch the error rate, and roll back in seconds without installing a service mesh. This walks through replica weighted canaries with a progressive delivery controller, real percentage splitting at the edge, an automated pass or fail check against Prometheus, and the rollback path. It also covers what changed when Kubernetes retired Ingress NGINX in March 2026.
Server & DevOpsHow to Set Up OpenSearch for Magento 2.4.7 on Ubuntu 22.04/24.04
Step-by-step instructions for installing and configuring OpenSearch for Magento 2.4.7 on Ubuntu, including single-node setup, optional cluster configuration, security certificates, and Magento integration.