Skip to content

Commit 7641354

Browse files
authored
Enable NPM trusted publishing with OIDC (#288)
## Summary Update npm publish workflow to use OIDC trusted publishing with provenance. ## Changes - Add `id-token: write` and `contents: read` permissions for OIDC authentication - Use `yarn npm publish` with `--provenance` flag for supply chain security - Remove `yarn pack` step (no longer needed with direct yarn publishing) - Update actions to v6 - Remove `NODE_AUTH_TOKEN` secret (no longer needed with OIDC) ## Status ✅ Trusted publishing has been configured on npmjs.com for this package.
1 parent ec9de77 commit 7641354

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
permissions:
16+
contents: read
1617
# https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions
1718
id-token: write
1819

@@ -32,15 +33,8 @@ jobs:
3233
- run: yarn run lint:ci
3334
- run: yarn run test
3435

35-
- run: yarn pack
3636
- name: Publish to NPM (dry run)
37-
# `yarn publish` does not support --provenance
38-
run: npm publish package.tgz --provenance --access public --dry-run
39-
env:
40-
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
37+
run: yarn npm publish --provenance --access public --dry-run
4138
- name: Publish to NPM
4239
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
43-
# `yarn publish` does not support --provenance
44-
run: npm publish package.tgz --provenance --access public
45-
env:
46-
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
40+
run: yarn npm publish --provenance --access public

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
],
1111
"repository": {
1212
"type": "git",
13-
"url": "https://github.com/foxglove/crc.git"
13+
"url": "git+https://github.com/foxglove/crc.git"
1414
},
1515
"author": {
1616
"name": "Foxglove",
@@ -52,5 +52,5 @@
5252
"typescript": "5.9.3",
5353
"typescript-eslint": "8.52.0"
5454
},
55-
"packageManager": "yarn@4.9.2"
55+
"packageManager": "yarn@4.12.0"
5656
}

0 commit comments

Comments
 (0)