Update publish.yml

This commit is contained in:
Jerry Wong authored and GitHub committed 2026-11-06 21:16:34 +08:00 Unverified
1 parent b9e2af29cf
commit d0b68be7ab
1 file changed
+10 -18
+10 -18
View File
@@ -1,27 +1,19 @@
name: npm publish
on:
release:
types: [created]
jobs:
build:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # OIDC 必須
id-token: write # OIDC 必須
steps:
- uses: actions/checkout@v4
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '24' # trusted publishing 需要 >= 22.14
# 不要設 registry-url:它會寫入 _authToken=${NODE_AUTH_TOKEN},空值會干擾 OIDC
- run: npm install -g npm@latest
- run: npm install
- run: npm publish --access public # 不用 NODE_AUTH_TOKEN