Skip to content

Commit

Permalink
ci(release.yml): 👷 publish with npm provenance
Browse files Browse the repository at this point in the history
  • Loading branch information
BeiyanYunyi committed Dec 11, 2024
1 parent 2bddb81 commit 8b07c2a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: 发包到 NPM

permissions:
id-token: write # For NPM Provenance, see https://docs.npmjs.com/generating-provenance-statements

on:
push:
branches:
Expand Down Expand Up @@ -46,13 +49,13 @@ jobs:
if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'release')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} # 使用 NPM 的认证 token
run: pnpm publish --tag prerelease --access public --no-git-checks
run: pnpm publish --tag prerelease --access public --no-git-checks --provenance

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

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

0 comments on commit 8b07c2a

Please sign in to comment.