Skip to content

ci: publish via npm Trusted Publishing (CONTXT-22349) - #532

Merged
omegafury merged 1 commit into
mainfrom
CONTXT-22349-npm-trusted-publishing
Sep 4, 2026
Merged

omegafury merged 1 commit into
mainfrom
CONTXT-22349-npm-trusted-publishing

Conversation

@omegafury

@omegafury omegafury commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Why

CONTXT-22349, under CONTXT-22345: the org npm token behind NIO_NPM_TOKEN is dead (npm whoami → 401), so the next release of @ndustrial/node-distributed-lock would tag and create a GitHub release and then fail to publish. Trusted Publishing removes the token from the equation.

What changed

  • publish.yaml publishes on the GitHub release that build.yaml creates, or by hand with a tag. Authenticates with OIDC (id-token: write, environment: npm), pins npm@11 (OIDC needs ≥ 11.5; npm 12 wants a newer Node than .nvmrc), runs npm publish with no _authToken.
  • build.yaml no longer publishes; it keeps the version bump, tag and GitHub release. Splitting them is what makes a failed publish retryable by one dispatch instead of a new commit.

Same shape as postgraphile-upsert-plugin/publish.yaml, which published 0.0.2 this way today.

After merge (npm side, any package maintainer)

npmjs.com → @ndustrial/node-distributed-lock → Settings → Trusted Publisher → GitHub Actions:

Field Value
Organization or user ndustrialio
Repository node-distributed-lock
Workflow filename publish.yaml
Environment name npm
Allow npm publish checked

Verifying

Dispatch Publish with the current latest tag. It will fail with EPUBLISHCONFLICT ("cannot publish over previously published version") — that error comes after authentication, so reaching it proves OIDC works. The next real feat:/fix: release then publishes for real.

🤖 Generated with Claude Code

publish.yaml already ran on releases; it now authenticates with OIDC
instead of JS-DevTools/npm-publish and the dead org token, takes a tag
for manual re-runs, and fires on any published release. build.yaml drops
an env block referencing a secret that does not exist. CONTXT-22349.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@omegafury
omegafury requested a review from a team as a code owner September 4, 2026 20:31
@omegafury

Copy link
Copy Markdown
Contributor Author

Trusted pubisher set up

@omegafury
omegafury merged commit 22b2a1e into main Sep 4, 2026
4 of 5 checks passed
@omegafury
omegafury deleted the CONTXT-22349-npm-trusted-publishing branch September 4, 2026 20:35
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