Skip to content

Stage the first npm release of a new package instead of refusing it - #91

Merged
colinjlacy merged 1 commit into
runtimeconditions:mainfrom
itvi-1234:npm-staged-first-publish
Nov 30, 2026
Merged

colinjlacy merged 1 commit into
runtimeconditions:mainfrom
itvi-1234:npm-staged-first-publish

Conversation

@itvi-1234

Copy link
Copy Markdown
Member

npm accepts a trusted publisher only for a package that already exists, so our workflow could not publish the first version of a new package, and publish-all stopped any real run that included one. Eight packages are waiting on this: aws-secrets-manager, aws-sqs, cql, file-system, gpu, kafka-service, observability and rabbitmq-service.

This uses npm's staged publishing for that first version. Before publishing anything, publish-npm.py checks each package on npm:

On npm What happens
Already published Published with trusted publishing, as before
Not there Staged with the stage-only token in NPM_STAGE_TOKEN. Staging needs no 2FA and publishes nothing until a maintainer approves it on npmjs.com with 2FA
Only the 0.0.0-stage placeholder A staged first release is waiting for approval, so it is skipped
  • If a package needs staging and the token is missing, the run stops before building or publishing anything.
  • The workflow installs npm 11.15.0, which staged publishing needs, and only the publish step gets the token.
  • publish-all now reports a first npm release as staged instead of blocking the run.

After approval, a maintainer adds a trusted publisher to the package with npm trust, and later releases use trusted publishing. The token stays for the next new extension; it can only stage, so nothing goes live without 2FA approval. Publishing with tokens directly ends in January 2027, but staging with a token stays supported.

New tests cover staging, the missing-token stop, the waiting placeholder and the npm lookup.

npm accepts a trusted publisher only for a package that already exists, so the
first version of a new package could not be published by this workflow, and
publish-all stopped any real run that included one. Eight packages are waiting
on this: aws-secrets-manager, aws-sqs, cql, file-system, gpu, kafka-service,
observability and rabbitmq-service.

npm's staged publishing fills that gap. publish-npm.py now asks npm about each
package before publishing any:

- already on npm: published with trusted publishing, as before
- not on npm: staged with the stage-only token in NPM_STAGE_TOKEN; staging
  needs no 2FA and publishes nothing until a maintainer approves the staged
  version on npmjs.com with 2FA
- only the 0.0.0-stage placeholder: a staged first release is waiting for
  approval, so it is skipped

When a package needs staging and the token is not set, the run stops before
building or publishing anything. After approval, a maintainer adds a trusted
publisher to the package, and later releases use trusted publishing.

The workflow installs npm 11.15.0, which staged publishing needs, and passes
the token only to the publish step. publish-all now reports a first npm release
as staged instead of blocking the run.

@colinjlacy colinjlacy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@colinjlacy
colinjlacy merged commit 0ab0316 into runtimeconditions:main Nov 30, 2026
3 checks passed
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.

2 participants