Skip to content

Commit b02d78a

Browse files
authored
Update release workflow to support npm trusted publshing (#25)
1 parent 555e3ad commit b02d78a

File tree

2 files changed

+31
-13
lines changed

2 files changed

+31
-13
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,11 @@ jobs:
5050
runs-on: ubuntu-latest
5151
if: "startsWith(github.ref, 'refs/tags/') && github.repository == 'sass/sync-message-port'"
5252
needs: [static_analysis, tests]
53-
54-
steps:
55-
- uses: actions/checkout@v5
56-
- uses: actions/setup-node@v6
57-
with:
58-
node-version: 'lts/*'
59-
check-latest: true
60-
registry-url: 'https://registry.npmjs.org'
61-
- run: npm install
62-
- run: npm run compile
63-
- run: npm publish
64-
env:
65-
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'
53+
permissions:
54+
attestations: write
55+
contents: write
56+
id-token: write
57+
uses: ./.github/workflows/release.yml
6658

6759
typedoc:
6860
runs-on: ubuntu-latest

.github/workflows/release.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
deploy:
8+
name: Deploy
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v5
13+
- uses: actions/setup-node@v6
14+
with:
15+
node-version: 'lts/*'
16+
check-latest: true
17+
registry-url: 'https://registry.npmjs.org'
18+
19+
# npm trusted publisher infrastructure requires npm >=11.5.1
20+
- run: npm install -g npm@latest
21+
22+
- run: npm install
23+
- run: npm run compile
24+
- run: npm publish
25+
env:
26+
NODE_AUTH_TOKEN: '${{ secrets.NPM_TOKEN }}'

0 commit comments

Comments
 (0)