From d0b68be7ab6f732a8c81a5d145dbeb0bbe9eaf72 Mon Sep 17 00:00:00 2001 From: Jerry Wong Date: Fri, 6 Nov 2026 21:16:34 +0800 Subject: [PATCH] Update publish.yml --- .github/workflows/publish.yml | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 498f63a..06f167f 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 }} \ No newline at end of file + - 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