mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-08-08 19:48:42 +08:00
chore: 更新 npm publish 工作流程,升級 actions 版本並使用 --provenance 進行發布
This commit is contained in:
@@ -3,17 +3,25 @@ name: npm publish
|
|||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# 這是 Trusted Publishing 必須的權限
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4 # 建議升級至較新版本的 checkout
|
||||||
# Setup .npmrc file to publish to npm
|
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v4 # 建議升級至較新版本的 setup-node
|
||||||
with:
|
with:
|
||||||
node-version: '12.x'
|
node-version: '20.x' # 建議換成你目前使用的 Node LTS 版本
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
- run: npm install
|
- run: npm install
|
||||||
- run: npm publish
|
|
||||||
env:
|
# 使用 --provenance 進行發布,OIDC 自動完成驗證,不再需要 env.NODE_AUTH_TOKEN
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
- run: npm publish --provenance
|
||||||
Reference in New Issue
Block a user