File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ name: Release
44on :
55 push :
66 tags :
7- - ' v* '
7+ - " v* "
88# 任务,定义个changelog 的任务
99jobs :
1010 changelog :
@@ -27,13 +27,25 @@ jobs:
2727 # 安装依赖
2828 - name : Install dependencies
2929 run : npm install
30+
31+ # 获取 tag 的版本类型(alpha 或 beta)
32+ - name : Determine release tag
33+ id : determine_tag
34+ run : |
35+ TAG=$(echo "${GITHUB_REF}" | sed 's/refs\/tags\/\(.*\)/\1/')
36+ PRERELEASE=$(echo $TAG | sed -n 's/.*-\(alpha\|beta\|rc\).*/\1/p')
37+ if [ -n "$PRERELEASE" ]; then
38+ echo "::set-output name=tag::$PRERELEASE"
39+ else
40+ echo "::set-output name=tag::latest"
41+ fi
3042 # # 打包
3143 # - name: Build Packages
3244 # run: pnpm run build
3345 # 发布npm 发布前执行了prepublishOnly
3446 - name : Publish npm
35- run : npm publish
47+ run : npm publish --tag ${{ steps.determine_tag.outputs.tag }}
3648 env :
3749 # 这里需要几个 Token 变量
3850 # NPM_TOKEN 需要在 npm 网站生成
39- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
51+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
You can’t perform that action at this time.
0 commit comments