Skip to content

Commit 0647c87

Browse files
chengzeyiclaude
andcommitted
ci: Simplify npm publish workflow for OIDC
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 32562f6 commit 0647c87

File tree

1 file changed

+15
-28
lines changed

1 file changed

+15
-28
lines changed

.github/workflows/npm-publish.yml

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,25 @@
1-
# This workflow will publish the package to npm when a release is created
2-
# Uses OIDC trusted publishing for secure, tokenless authentication
3-
4-
name: npm-publish
1+
name: Publish Package
52

63
on:
7-
release:
8-
types: [published]
9-
workflow_dispatch:
4+
push:
5+
tags:
6+
- 'v*'
107

118
permissions:
9+
id-token: write # Required for OIDC
1210
contents: read
13-
id-token: write
1411

1512
jobs:
1613
publish:
1714
runs-on: ubuntu-latest
1815
steps:
19-
- name: Checkout code
20-
uses: actions/checkout@v4
21-
with:
22-
fetch-depth: 0
23-
24-
- name: Setup Node.js
25-
uses: actions/setup-node@v4
26-
with:
27-
node-version: '20'
28-
cache: 'npm'
29-
registry-url: 'https://registry.npmjs.org'
30-
31-
- name: Install dependencies
32-
run: npm ci
33-
34-
- name: Build package
35-
run: npm run build
36-
37-
- name: Publish to npm
38-
run: npm publish --provenance --access public
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: '24'
21+
registry-url: 'https://registry.npmjs.org'
22+
- run: npm ci
23+
- run: npm run build --if-present
24+
- run: npm test
25+
- run: npm publish

0 commit comments

Comments
 (0)