Skip to content

Commit 51c8f32

Browse files
committed
ci: switch to npm trusted publishing with OIDC
1 parent 2d85526 commit 51c8f32

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

.github/workflows/npm-publish.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
name: NPM publish
22
on:
33
workflow_call:
4-
secrets:
5-
NPM_TOKEN:
6-
required: true
74
jobs:
85
build:
96
name: 'npm publish'
107
runs-on: ubuntu-latest
118
environment: production
9+
permissions:
10+
id-token: write
11+
contents: read
1212
steps:
1313
- name: 'Checkout source code'
1414
uses: 'actions/checkout@v3'
@@ -18,19 +18,16 @@ jobs:
1818
- name: 'Show current version'
1919
run: grep '"version"' package.json
2020

21-
# Setup .npmrc file to publish to npm
2221
- name: Setup Node.js environment
2322
uses: actions/setup-node@v3
2423
with:
25-
node-version: '16.x'
24+
node-version: '20.x'
2625
always-auth: true
2726
scope: '@openbeta'
2827
registry-url: 'https://registry.npmjs.org'
2928

30-
- run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> ~/.npmrc
29+
- name: Update npm
30+
run: npm install -g npm@11
3131

3232
- name: NPM publish
33-
run: yarn install --no-progress && yarn lint && yarn test && yarn build && yarn publish --access public
34-
env:
35-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36-
33+
run: yarn install --no-progress && yarn lint && yarn test && yarn build && npm publish --provenance --access public

0 commit comments

Comments
 (0)