-
Notifications
You must be signed in to change notification settings - Fork 390
235 lines (205 loc) · 8.45 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
name: Build and publish
on:
push:
tags:
- 'v**'
jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: nowsprinting/check-version-format-action@v3
id: version
with:
prefix: 'v'
- name: Check valid tag format
if: steps.version.outputs.is_valid == 'false'
run: exit 1
- name: Get branch names
id: branch-name
uses: tj-actions/[email protected]
with:
strip_tag_prefix: v
- name: Get the current tag
if: steps.branch-name.outputs.is_tag == 'true' # Replaces: startsWith(github.ref, 'refs/tags/')
run: |
echo "tag: ${{ steps.branch-name.outputs.tag }}"
echo "current_branch: ${{ steps.branch-name.outputs.current_branch }}"
echo "ref_branch: ${{ steps.branch-name.outputs.ref_branch }}"
- name: Check valid branch
if: ${{ !startsWith(steps.branch-name.outputs.tag, '2.') }}
run: exit 1
# checkout branch 2.6
- name: Checkout branch 2.6
uses: actions/checkout@v2
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.6') }}
with:
ref: '2.6'
# checkout branch 2.5
- name: Checkout branch 2.5
uses: actions/checkout@v2
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.5') }}
with:
ref: '2.5'
# checkout branch 2.4
- name: Checkout branch 2.4
uses: actions/checkout@v2
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.4') }}
with:
ref: '2.4'
# checkout branch 2.3
- name: Checkout branch 2.3
uses: actions/checkout@v2
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.3') }}
with:
ref: '2.3'
# checkout branch 2.2
- name: Checkout branch 2.2
uses: actions/checkout@v2
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.2') }}
with:
ref: '2.2'
# checkout branch 2.1
- name: Checkout branch 2.1
uses: actions/checkout@v2
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.1') }}
with:
ref: '2.1'
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- run: yarn --frozen-lockfile
- name: Bootstrap platform
run: |
yarn bootstrap
- name: Build platform
env:
CI: false
run: |
yarn build
- name: Lerna publish 2.1
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.1') && steps.version.outputs.is_stable == 'true'}}
run: |
git config user.name github-actions
git config user.email [email protected]
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
yarn lerna publish ${{ steps.branch-name.outputs.tag }} --no-git-tag-version --no-git-reset --force-publish --exact --yes --dist-tag 2.1
git add .
git commit -m "action: release ${{ steps.branch-name.outputs.tag }}"
git push
env:
CI: false
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Lerna publish 2.2
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.2') && steps.version.outputs.is_stable == 'true'}}
run: |
git config user.name github-actions
git config user.email [email protected]
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
yarn lerna publish ${{ steps.branch-name.outputs.tag }} --no-git-tag-version --no-git-reset --force-publish --exact --yes --dist-tag 2.2
git add .
git commit -m "action: release ${{ steps.branch-name.outputs.tag }}"
git push
env:
CI: false
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Lerna publish 2.3
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.3') && steps.version.outputs.is_stable == 'true' }}
run: |
git config user.name github-actions
git config user.email [email protected]
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
yarn lerna publish ${{ steps.branch-name.outputs.tag }} --no-git-tag-version --no-git-reset --force-publish --exact --yes --dist-tag 2.3
git add .
git commit -m "action: release ${{ steps.branch-name.outputs.tag }}"
git push
env:
CI: false
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Lerna publish 2.4
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.4') && steps.version.outputs.is_stable == 'true' }}
run: |
git config user.name github-actions
git config user.email [email protected]
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
yarn lerna publish ${{ steps.branch-name.outputs.tag }} --no-git-tag-version --no-git-reset --force-publish --exact --yes --dist-tag 2.4
git add .
git commit -m "action: release ${{ steps.branch-name.outputs.tag }}"
git push
env:
CI: false
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Lerna publish 2.5
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.5') && steps.version.outputs.is_stable == 'true' }}
run: |
git config user.name github-actions
git config user.email [email protected]
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
yarn lerna publish ${{ steps.branch-name.outputs.tag }} --no-git-tag-version --no-git-reset --force-publish --exact --yes
git add .
git commit -m "action: release ${{ steps.branch-name.outputs.tag }}"
git push
env:
CI: false
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Lerna publish 2.6
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.6') && steps.version.outputs.is_stable == 'true' }}
run: |
git config user.name github-actions
git config user.email [email protected]
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
yarn lerna publish ${{ steps.branch-name.outputs.tag }} --no-git-tag-version --no-git-reset --force-publish --exact --yes --dist-tag next
git add .
git commit -m "action: release ${{ steps.branch-name.outputs.tag }}"
git push
env:
CI: false
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Lerna publish beta
if: ${{ steps.version.outputs.is_stable != 'true' }}
run: |
git config user.name github-actions
git config user.email [email protected]
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
yarn lerna publish ${{ steps.branch-name.outputs.tag }} --no-git-tag-version --no-git-reset --force-publish --exact --yes --dist-tag beta
git add .
git commit -m "action: release ${{ steps.branch-name.outputs.tag }}"
git push
env:
CI: false
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Merge 2.5 -> master
if: ${{ startsWith(steps.branch-name.outputs.tag, '2.5') }} # && steps.version.outputs.is_stable == 'true'}}
uses: devmasx/merge-branch@master
with:
type: now
from_branch: 2.5
target_branch: master
github_token: ${{ github.token }}
- name: Sleep 120s, wait for npm cache
uses: juliangruber/sleep-action@v1
with:
time: 120s
- name: Create Docker Release
# if: steps.version.outputs.is_stable == 'true'
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.DOCKER_GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
owner: steedos
repo: docker
commitish: main
tag_name: v${{ steps.branch-name.outputs.tag }}
release_name: Release v${{ steps.branch-name.outputs.tag }}
draft: false
prerelease: false
- name: Sync NpmMirror
env:
CI: false
run: |
yarn sync