Skip to content

Commit dc72d40

Browse files
committed
npm trusted publishing
1 parent a656f47 commit dc72d40

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

.github/workflows/prebuild-and-publish.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,16 @@ jobs:
9494
name: Create release and publish
9595
runs-on: ubuntu-latest
9696
needs: build-prebuilds
97+
permissions:
98+
contents: write
99+
id-token: write
97100
steps:
98101
- uses: actions/checkout@v4
102+
- name: Setup Node
103+
uses: actions/setup-node@v4
104+
with:
105+
node-version: '20'
106+
registry-url: 'https://registry.npmjs.org'
99107
- name: Download artifacts
100108
uses: actions/download-artifact@v4
101109
with:
@@ -109,13 +117,5 @@ jobs:
109117
generate_release_notes: true
110118
env:
111119
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
112-
- name: Authenticate to npm
113-
env:
114-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
115-
run: |
116-
# Write a temporary .npmrc so npm publish is authenticated on the runner
117-
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
118-
119120
- name: Publish to npm
120-
run: |
121-
npm publish --access public --ignore-scripts
121+
run: npm publish --access public --provenance --ignore-scripts

0 commit comments

Comments
 (0)