55 tags :
66 - ' v*' # 当推送以 'v' 开头的标签时触发
77
8+ permissions :
9+ contents : write # 给 release 创建权限
10+
811jobs :
912 release :
1013 runs-on : ubuntu-latest
@@ -13,43 +16,50 @@ jobs:
1316 - name : Checkout code
1417 uses : actions/checkout@v4
1518 with :
16- fetch-depth : 0 # 获取完整的git历史,包括标签
19+ fetch-depth : 0
20+
21+ - name : Setup pnpm
22+ uses : pnpm/action-setup@v3
23+ with :
24+ version : 10.14.0
25+ run_install : false
1726
1827 - name : Setup Node.js
1928 uses : actions/setup-node@v4
2029 with :
2130 node-version : ' 18'
22- cache : ' npm '
31+ cache : ' pnpm '
2332
2433 - name : Install dependencies
25- run : npm ci
34+ run : pnpm install --frozen-lockfile
2635
2736 - name : Run convert-changelog script
2837 run : node scripts/convert-changelog.js
2938 env :
30- GITHUB_ACTIONS : ' true' # 告诉脚本这是在GitHub Actions环境中运行
39+ GITHUB_ACTIONS : ' true'
3140
3241 - name : Create Release
3342 uses : actions/create-release@v1
3443 env :
3544 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3645 with :
37- tag_name : ${{ github.ref }}
38- release_name : Release ${{ github.ref }}
46+ # github.ref 格式是 refs/tags/v1.0.0,需要提取 tag 名
47+ tag_name : ${{ github.ref_name }}
48+ release_name : Release ${{ github.ref_name }}
3949 body : |
4050 ## 变更日志
4151
4252 请查看 [CHANGELOG](CHANGELOG) 文件了解详细变更内容。
4353
4454 ## 下载
4555
46- - [Source code (zip)](https://github.com/${{ github.repository }}/archive/${{ github.ref }}.zip)
47- - [Source code (tar.gz)](https://github.com/${{ github.repository }}/archive/${{ github.ref }}.tar.gz)
56+ - [Source code (zip)](https://github.com/${{ github.repository }}/archive/${{ github.ref_name }}.zip)
57+ - [Source code (tar.gz)](https://github.com/${{ github.repository }}/archive/${{ github.ref_name }}.tar.gz)
4858 draft : false
4959 prerelease : false
5060
5161 - name : Build project
52- run : npm run build
62+ run : pnpm run build
5363
5464 - name : Upload build artifacts
5565 uses : actions/upload-artifact@v4
0 commit comments