Skip to content

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

Merged
kdaviduik merged 1 commit into
mainfrom
03-14-feat_migrate_npm-release.yml_to_oidc_trusted_publishing
Sep 15, 2026
Merged

kdaviduik merged 1 commit into
mainfrom
03-14-feat_migrate_npm-release.yml_to_oidc_trusted_publishing

Conversation

@kdaviduik

@kdaviduik kdaviduik commented Mar 14, 2026

Copy link
Copy Markdown
Contributor

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


Summary

  • Migrate npm-release.yml from static NPM_TOKEN to OIDC trusted publishing
  • Fix package.json repository field from SSH shorthand to structured HTTPS format (required for provenance attestation, which is a prerequisite for OIDC trusted publishing)

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 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. To get /snapit to work we would need to move the contents of the snapit.yml into npm-release.yml.

  • 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

@kdaviduik
kdaviduik force-pushed the 03-13-chore_delete_deploying.md branch from 018b0c0 to c6173bc Compare March 14, 2026 22:53
@kdaviduik
kdaviduik force-pushed the 03-14-feat_migrate_npm-release.yml_to_oidc_trusted_publishing branch from 52ca1a3 to 9383c98 Compare March 14, 2026 22:53
@kdaviduik
kdaviduik force-pushed the 03-14-feat_migrate_npm-release.yml_to_oidc_trusted_publishing branch 2 times, most recently 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
@kdaviduik
kdaviduik force-pushed the 03-14-feat_migrate_npm-release.yml_to_oidc_trusted_publishing branch from cfb88ff to 4a595c2 Compare September 15, 2026 21:51
@kdaviduik
kdaviduik changed the base branch from graphite-base/952 to main September 15, 2026 21:52
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:
- Remove NODE_AUTH_TOKEN env var (leaving it undefined triggers OIDC)
- Set NPM_TOKEN to empty string (forces OIDC fallback)
- Add a Test OIDC Token step that verifies the OIDC token exchange
  succeeds before the publish step runs
- Fix package.json repository field from SSH shorthand to structured
  HTTPS format (required for OIDC provenance attestation)
- id-token: write permission already present on main

Node 24 (bundling npm 11 with native OIDC support) already landed on
main via PR #955, so no node bump is needed here.

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.

Co-Authored-By: Claude <noreply@anthropic.com>
@kdaviduik
kdaviduik force-pushed the 03-14-feat_migrate_npm-release.yml_to_oidc_trusted_publishing branch from 4a595c2 to d0d0ef2 Compare September 15, 2026 21:54
@kdaviduik
kdaviduik marked this pull request as ready for review September 15, 2026 21:55
@kdaviduik
kdaviduik requested a review from a team as a code owner September 15, 2026 21:55
@kdaviduik
kdaviduik merged commit fd36e84 into main Sep 15, 2026
5 checks passed
@kdaviduik
kdaviduik deleted the 03-14-feat_migrate_npm-release.yml_to_oidc_trusted_publishing branch September 15, 2026 22:09
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