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
4
4
on :
5
5
push :
6
6
tags :
7
- - ' v* '
7
+ - " v* "
8
8
# 任务,定义个changelog 的任务
9
9
jobs :
10
10
changelog :
@@ -27,13 +27,25 @@ jobs:
27
27
# 安装依赖
28
28
- name : Install dependencies
29
29
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
30
42
# # 打包
31
43
# - name: Build Packages
32
44
# run: pnpm run build
33
45
# 发布npm 发布前执行了prepublishOnly
34
46
- name : Publish npm
35
- run : npm publish
47
+ run : npm publish --tag ${{ steps.determine_tag.outputs.tag }}
36
48
env :
37
49
# 这里需要几个 Token 变量
38
50
# 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