Skip to content

Commit bb4a4fa

Browse files
committed
enable npm trusted publishing
switch from token-based auth to OIDC provenance for npm publishes
1 parent ef859fb commit bb4a4fa

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,18 +147,17 @@ jobs:
147147
runs-on: ubuntu-latest
148148
needs: test
149149
if: startsWith(github.ref, 'refs/tags/v')
150-
environment:
151-
name: npm
152-
url: https://www.npmjs.com/package/directory-indexer
153-
150+
permissions:
151+
contents: read
152+
id-token: write
154153
steps:
155154
- name: Checkout code
156155
uses: actions/checkout@v4
157156

158157
- name: Setup Node.js
159158
uses: actions/setup-node@v4
160159
with:
161-
node-version: "18"
160+
node-version: "22"
162161
registry-url: "https://registry.npmjs.org"
163162
cache: "npm"
164163

@@ -172,6 +171,4 @@ jobs:
172171
run: npm pack --dry-run
173172

174173
- name: Publish to npm
175-
run: npm publish
176-
env:
177-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
174+
run: npm publish --provenance --access public

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"engines": {
4343
"node": ">=18.0.0"
4444
},
45+
"publishConfig": {
46+
"provenance": true,
47+
"access": "public"
48+
},
4549
"files": [
4650
"dist/",
4751
"bin/"

0 commit comments

Comments
 (0)