Skip to content

Commit 6ab30fb

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

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,33 @@
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'
14-
uses: 'actions/checkout@v3'
14+
uses: 'actions/checkout@v4'
1515
with:
1616
ref: develop
1717

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
23-
uses: actions/setup-node@v3
22+
uses: actions/setup-node@v4
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)