Skip to content

Commit 53e2f1a

Browse files
committed
ci: add NPM publish workflow via OIDC
1 parent 975005a commit 53e2f1a

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish to NPM
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write # Requerido para NPM Provenance (Trusted Publisher)
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- uses: pnpm/action-setup@v4
17+
name: Install pnpm
18+
with:
19+
run_install: false
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20.x'
25+
registry-url: 'https://registry.npmjs.org'
26+
27+
- name: Install dependencies
28+
run: pnpm install --frozen-lockfile
29+
30+
- name: Build project
31+
run: pnpm run build
32+
33+
- name: Publish to NPM
34+
run: pnpm publish --access public --no-git-checks --provenance
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)