Skip to content

Commit 403e428

Browse files
Update npm-publish workflow for GitHub Actions
1 parent 21c0b81 commit 403e428

1 file changed

Lines changed: 32 additions & 20 deletions

File tree

Lines changed: 32 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
11
name: Publish to npm
22

33
on:
4-
release:
5-
types: [published]
4+
release:
5+
types: [published]
66

77
jobs:
8-
publish:
9-
runs-on: ubuntu-latest
8+
publish:
9+
runs-on: ubuntu-latest
1010

11-
steps:
12-
- name: πŸ“₯ Checkout repo
13-
uses: actions/checkout@v4
11+
```
12+
permissions:
13+
contents: read
14+
packages: write
1415
15-
- name: βš™οΈ Setup Node.js
16-
uses: actions/setup-node@v4
17-
with:
18-
node-version: 20
19-
registry-url: https://registry.npmjs.org/
16+
steps:
17+
- name: πŸ“₯ Checkout repo
18+
uses: actions/checkout@v5
2019
21-
- name: πŸ“¦ Install deps
22-
run: npm install
20+
- name: βš™οΈ Setup Node.js
21+
uses: actions/setup-node@v5
22+
with:
23+
node-version: 20
24+
registry-url: https://registry.npmjs.org/
25+
cache: 'npm'
2326
24-
- name: πŸ— Build
25-
run: npm run build
27+
- name: πŸ“¦ Install deps
28+
run: npm ci
2629
27-
- name: πŸš€ Publish to npm
28-
run: npm publish --access public
29-
env:
30-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
30+
- name: πŸ— Build
31+
run: npm run build
32+
33+
- name: πŸ” Verify npm auth
34+
run: npm whoami
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
38+
- name: πŸš€ Publish to npm
39+
run: npm publish --access public
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
```

0 commit comments

Comments
Β (0)