3
3
# When Release Pull Request is merged
4
4
push :
5
5
branches :
6
- - develop
6
+ - ' v[0-9]+.[0-9]+.[0-9]+*'
7
+ - ' next/v[0-9]+.[0-9]+.[0-9]+*'
7
8
8
9
permissions :
9
10
contents : write # for checkout and tag
36
37
run : |
37
38
CURRENT_VERSION=$(node -p 'require("./lerna.json").version')
38
39
echo "CURRENT_VERSION=${CURRENT_VERSION}" >> $GITHUB_ENV
40
+ - name : Prerelease Check
41
+ id : prerelease_check
42
+ run : |
43
+ if [[ ${REF_NAME} =~ ^next\/v[0-9]+\.[0-9]+\.[0-9]+.* ]]; then
44
+ echo ::set-output name=prerelease::true
45
+ else
46
+ echo ::set-output name=prerelease::false
47
+ fi
48
+ env :
49
+ REF_NAME : ${{ github.ref_name }}
39
50
- name : Tag Check
40
51
id : tag_check
41
52
run : |
@@ -60,24 +71,27 @@ jobs:
60
71
git_tag_prefix : " v"
61
72
- name : Create Release
62
73
id : create_release
63
- if : steps.tag_check.outputs.exists_tag == 'false' && github.event.pull_request.merged == true
74
+ if : steps.tag_check.outputs.exists_tag == 'false'
64
75
uses : actions/create-release@v1
65
76
env :
66
77
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
78
+ RELEASE_BODY : ${{ github.event.commits[0].message }}
67
79
with :
68
80
tag_name : v${{ env.CURRENT_VERSION }}
69
81
# Copy Pull Request's tile and body to Release Note
70
- release_name : ${{ github.event.pull_request.title }}
82
+ release_name : ${{ env.CURRENT_VERSION }}
71
83
body : |
72
- ${{ github.event.pull_request.body }}
84
+ ${{ env.RELEASE_BODY }}
73
85
draft : false
74
- prerelease : false
86
+ prerelease : steps.tag_check.prerelease_check.prerelease == 'true'
87
+
75
88
- name : Publish
76
89
if : steps.tag_check.outputs.exists_tag == 'false'
77
90
run : |
78
91
yarn run build
79
92
yarn run build-release
80
- yarn lerna publish from-package --yes
93
+ yarn lerna publish from-package --yes --dist-tag $([ $PRERELEASE == 'true' ] && echo 'next' || echo 'latest')
81
94
env :
82
95
GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
83
96
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
97
+ PRERELEASE : ${{ steps.prerelease_check.outputs.prerelease }}
0 commit comments