Skip to content

Commit 7ef4910

Browse files
authored
Update autopublish workflow to use NPM Trusted Publisher setup (#45521)
1 parent c368dcb commit 7ef4910

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

.github/files/gh-npmjs-autopublisher/workflows/npmjs-autopublisher.yml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,15 @@ on:
66
- 'v*.*.*'
77
workflow_dispatch:
88

9+
permissions:
10+
id-token: write # Required for OIDC
11+
contents: read
12+
913
jobs:
1014
publish:
1115
name: Publish
1216
runs-on: ubuntu-latest
1317
steps:
14-
- name: Check that the secret is set
15-
env:
16-
TOKEN: ${{ secrets.NPMJS_AUTOMATION_TOKEN }}
17-
run: |
18-
if [[ -z "$TOKEN" ]]; then
19-
echo '::error::The secret NPMJS_AUTOMATION_TOKEN must be set.'
20-
exit 1
21-
fi
22-
2318
- uses: actions/checkout@v4
2419

2520
- uses: actions/setup-node@v4
@@ -29,6 +24,6 @@ jobs:
2924
registry-url: 'https://registry.npmjs.org'
3025

3126
- name: Publish
32-
env:
33-
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_AUTOMATION_TOKEN }}
34-
run: npm publish --access public
27+
run: |
28+
npm install -g npm@latest
29+
npm publish --access public

0 commit comments

Comments
 (0)