Skip to content

Publish to npm with trusted publishing (OIDC) instead of NPM_TOKEN - #189

Draft
sandshoes wants to merge 1 commit into
mainfrom
npm-trusted-publishing
Draft

sandshoes wants to merge 1 commit into
mainfrom
npm-trusted-publishing

Conversation

@sandshoes

@sandshoes sandshoes commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Switches publish.yml from a stored npm token to npm trusted publishing. Each publish job gets a short-lived OIDC token from GitHub and exchanges it with npm for a short-lived, package-scoped publish token. No npm credential is stored in the repo.

Changes

  • Both publish jobs run in the release environment with id-token: write. NODE_AUTH_TOKEN is removed.
  • npm is upgraded to ^11.5.1, the minimum for trusted publishing (Node 20 ships npm 10).
  • Pack with pnpm, publish with npm. pnpm pack turns "@tinybirdco/sdk": "workspace:*" in the MCP package into the real version. npm publish <tarball> then authenticates via OIDC and attaches provenance automatically.
  • Already-published versions are skipped. pnpm --filter … publish used to skip them silently. npm publish fails on them instead, so the job checks npm view name@version first. Without this, every merge that doesn't bump a version would fail.
  • A repository field is added to @tinybirdco/sdk and @tinybirdco/devtools-mcp (with directory: mcp). npm checks provenance against it.

Verification

  • The workflow YAML parses, and both jobs have environment: release and id-token: write.
  • Skip path, run locally against the current versions: @tinybirdco/sdk@0.0.84 and @tinybirdco/devtools-mcp@0.0.3 are detected as published and skipped.
  • pnpm pack in mcp/ produces a tarball with "@tinybirdco/sdk": "0.0.84", not workspace:*.
  • npm publish <tarball> --dry-run accepts the tarball.
  • The OIDC exchange itself can only be verified in GitHub Actions.

Requires trusted-publisher configuration before merge (tracked internally).

🤖 Generated with Claude Code

- Publish jobs run in the `release` environment and obtain a
  short-lived publish token via GitHub OIDC; NODE_AUTH_TOKEN removed.
- Upgrade npm to >= 11.5.1 (required for trusted publishing).
- Pack with pnpm (resolves workspace: deps), publish the tarball with
  npm (OIDC + automatic provenance).
- Skip versions that are already published, matching the previous
  pnpm --filter publish behavior.
- Add `repository` to both packages, required for provenance.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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