Skip to content

feat: migrate npm-release.yml to OIDC trusted publishing#952

Draft
kdaviduik wants to merge 1 commit intographite-base/952from
03-14-feat_migrate_npm-release.yml_to_oidc_trusted_publishing
Draft

feat: migrate npm-release.yml to OIDC trusted publishing#952
kdaviduik wants to merge 1 commit intographite-base/952from
03-14-feat_migrate_npm-release.yml_to_oidc_trusted_publishing

Conversation

@kdaviduik
Copy link
Copy Markdown
Contributor

@kdaviduik kdaviduik commented Mar 14, 2026

Part of https://github.com/Shopify/developer-tools-team/issues/1195


Summary

  • Migrate npm-release.yml from static NPM_TOKEN to OIDC trusted publishing
  • Upgrade CI Node version from 18.20 to 24 (bundles npm 11 with native OIDC support)
  • Fix package.json repository field from SSH shorthand to structured HTTPS format (required for provenance attestation)

Why

OIDC replaces long-lived NPM_TOKEN secrets with short-lived tokens derived from the GitHub Actions workflow identity. This eliminates the risk of credential compromise — tokens are scoped to the specific workflow run and cannot be reused. Standard at Shopify (Hydrogen, CLI, theme-tools, flash-list).

npm classic tokens were revoked December 9, 2025. This repo's NPM_TOKEN was a classic token, so it's already dead and this migration is a necessity in order to do future npm releases.

How OIDC works

  1. id-token: write permission (already present from PR 1) allows the workflow to request an OIDC token from GitHub
  2. setup-node with registry-url configures .npmrc for auth
  3. NODE_AUTH_TOKEN is NOT set — this causes npm to fall through to OIDC token exchange
  4. NPM_TOKEN: '' (empty string) explicitly forces OIDC fallback
  5. npm 11 (bundled with Node 24) natively supports OIDC token exchange with npmjs.com

Snapit

(similar to Hydrogen) Snapit OIDC migration is deferred. Only npm-release.yml is configured as a Trusted Publisher on npmjs.com.

  • We do not need /snapit to test our changes and verify everything works. We can instead just manually build this package and use that rather than the npm release from /snapit

Replace static NPM_TOKEN authentication with OIDC token exchange for
npm publishing. OIDC provides short-lived tokens derived from the
GitHub Actions workflow identity, eliminating the risk of long-lived
credential compromise.

Key changes:
- Node version: 18.20 → 24 (bundles npm 11 with native OIDC support)
- Remove NODE_AUTH_TOKEN env var (leaving it undefined triggers OIDC)
- Set NPM_TOKEN to empty string (forces OIDC fallback)
- Fix package.json repository field from SSH shorthand to structured
  HTTPS format (required for OIDC provenance attestation)
- id-token: write permission already present from PR 1

Build gate: verified build + 794 tests pass on Node 24.14.0 (npm 11.9.0)

Snapit OIDC migration deferred — only npm-release.yml is configured as
a Trusted Publisher on npmjs.com. Snapit continues using NPM_TOKEN.
@kdaviduik kdaviduik force-pushed the 03-14-feat_migrate_npm-release.yml_to_oidc_trusted_publishing branch from 8ebf841 to cfb88ff Compare March 15, 2026 02:39
@kdaviduik kdaviduik force-pushed the 03-13-chore_delete_deploying.md branch from c6173bc to 215a2cc Compare March 15, 2026 02:39
@kdaviduik kdaviduik changed the base branch from 03-13-chore_delete_deploying.md to graphite-base/952 March 18, 2026 19:01
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