Skip to content

Commit d2c1fa9

Browse files
alZyadclaude
andauthored
chore: configure npm trusted publishing via OIDC (#147)
Switch publish workflow from NPM_TOKEN to GitHub Actions trusted publishing. Adds id-token: write permission, sets registry-url on setup-node, upgrades npm to a version that supports OIDC, and removes the token-based .npmrc step. Provenance attestations are now generated automatically. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 2c9d1b1 commit d2c1fa9

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

.github/workflows/publish.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,30 @@ jobs:
99
publish:
1010
runs-on: ubuntu-latest
1111
environment: npm-publish
12+
permissions:
13+
id-token: write
14+
contents: read
1215

1316
steps:
1417
- name: Checkout code
15-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1619
with:
17-
ref: "main" # Replace with your branch name
20+
ref: "main"
1821

1922
- name: Use Node.js
20-
uses: actions/setup-node@v3
23+
uses: actions/setup-node@v4
2124
with:
2225
node-version-file: .nvmrc
26+
registry-url: "https://registry.npmjs.org"
27+
28+
- name: Upgrade npm for trusted publishing
29+
run: npm install -g npm@latest
2330

2431
- name: Install dependencies
2532
run: yarn --immutable
2633

2734
- name: Build eslint-plugin
2835
run: yarn workspace @bam.tech/eslint-plugin build
2936

30-
- name: Set up .npmrc file
31-
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
32-
3337
- name: Publish to npm
3438
run: npx lerna publish from-package --no-private --yes
35-
env:
36-
NPM_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)