Skip to content

Commit efe821c

Browse files
authored
feat: enable npm Trusted Publishers (#1422)
Enables npm Trusted Publishers for secure publishing without manual token management. **Changes:** - Update Node version to 24 (required for npm 11+) - Add `id-token: write` permission for OIDC authentication - Add `--provenance` flag to publish commands - Remove `NODE_AUTH_TOKEN` environment variable (no longer needed) **Benefits:** - More secure authentication using OIDC - Cryptographic provenance for published packages - No need to manage NPM_TOKEN secrets
1 parent 2371819 commit efe821c

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ jobs:
1515
test:
1616
name: Publish to NPM
1717
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
id-token: write
1821
steps:
1922
- uses: actions/checkout@v4
2023
- uses: actions/setup-node@v4
2124
with:
22-
node-version: 18
25+
node-version: 24
2326
registry-url: 'https://registry.npmjs.org'
2427

2528
- name: Install Dependencies
@@ -32,15 +35,11 @@ jobs:
3235
3336
- name: Publish
3437
if: ${{ !github.event.release.prerelease }}
35-
env:
36-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3738
run: |
38-
npm publish --tag latest --access=public
39+
npm publish --tag latest --access=public --provenance
3940
4041
- name: Publish Pre-Release
4142
if: ${{ github.event.release.prerelease }}
42-
env:
43-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4443
run: |
4544
# Tags may come prefixed with "v" which we want to remove before putting
4645
# it as the version of this deploy. E.g. this will turn "v7.5.0-beta" to "7.5.0-beta"
@@ -51,4 +50,4 @@ jobs:
5150
echo "Deploying with package.json"
5251
cat package.json
5352
54-
npm publish --tag next --access=public
53+
npm publish --tag next --access=public --provenance

0 commit comments

Comments
 (0)