Skip to content

Commit 8b07c2a

Browse files
committed
ci(release.yml): 👷 publish with npm provenance
1 parent 2bddb81 commit 8b07c2a

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

.github/workflows/release.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: 发包到 NPM
22

3+
permissions:
4+
id-token: write # For NPM Provenance, see https://docs.npmjs.com/generating-provenance-statements
5+
36
on:
47
push:
58
branches:
@@ -46,13 +49,13 @@ jobs:
4649
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'release')
4750
env:
4851
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # 使用 NPM 的认证 token
49-
run: pnpm publish --tag prerelease --access public --no-git-checks
52+
run: pnpm publish --tag prerelease --access public --no-git-checks --provenance
5053

5154
- name: 发布到 NPM(使用 tag 的正式版本发布)
5255
if: startsWith(github.ref, 'refs/tags/')
5356
env:
5457
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # 使用 NPM 的认证 token
55-
run: pnpm publish --access public --no-git-checks
58+
run: pnpm publish --access public --no-git-checks --provenance
5659

5760
- name: 设置发布类型为正式或预发布
5861
id: set_release_type

0 commit comments

Comments
 (0)