Skip to content

Commit 9383c98

Browse files
committed
feat: migrate npm-release.yml to OIDC trusted publishing
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.
1 parent c6173bc commit 9383c98

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/npm-release.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Setup Node.js
3434
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
3535
with:
36-
node-version: "18.20"
36+
node-version: "24"
3737
cache: 'pnpm'
3838
registry-url: 'https://registry.npmjs.org'
3939

@@ -56,6 +56,8 @@ jobs:
5656
# scoped to this repo only (contents:write, pull-requests:write),
5757
# rotated every 2 hours via github-actions-access-provider.
5858
GITHUB_TOKEN: ${{ secrets.SHOPIFY_GH_ACCESS_TOKEN }}
59-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
60-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
61-
NPM_CONFIG_PROVENANCE: true
59+
# Empty NPM_TOKEN forces npm to fall through to OIDC token exchange.
60+
# Do NOT set NODE_AUTH_TOKEN — setup-node's registry-url writes it
61+
# into .npmrc; leaving it undefined triggers the OIDC flow.
62+
NPM_TOKEN: ''
63+
NPM_CONFIG_PROVENANCE: true

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
],
1313
"description": "BuyButton.js allows merchants to build Shopify interfaces into any website",
1414
"main": "lib/buybutton.umd.js",
15-
"repository": "git@github.com:Shopify/buy-button-js.git",
15+
"repository": {
16+
"type": "git",
17+
"url": "git+https://github.com/Shopify/buy-button-js.git"
18+
},
1619
"publishConfig": {
1720
"access": "public",
1821
"@shopify:registry": "https://registry.npmjs.org/",

0 commit comments

Comments
 (0)