-
Notifications
You must be signed in to change notification settings - Fork 41
395 lines (340 loc) · 12.6 KB
/
global-release.yaml
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
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
name: Global Release
on:
workflow_dispatch:
inputs:
bump:
description: 'Bump rule'
required: false
default: patch
type: choice
options:
- major
- minor
- patch
- prerelease
version:
description: 'Release version (ommit to bump)'
required: false
skip_grpc:
description: 'Skip grpc?'
type: boolean
default: 'false'
required: false
skip_sdk:
description: 'Skip sdk?'
type: boolean
default: 'false'
required: false
skip_cli:
description: 'Skip cli?'
type: boolean
default: 'false'
required: false
skip_runtime:
description: 'Skip runtime?'
type: boolean
default: 'false'
required: false
skip_services:
description: 'Skip services?'
type: boolean
default: 'false'
required: false
skip_release:
description: 'Skip release?'
type: boolean
default: 'false'
required: false
env:
DOCKER_REGISTRY_URL: hydrosphere
# Secrets:
# HYDRO_SERVING_TOKEN - github token with write access to all hydrosphere repos
jobs:
version:
name: Determine release version
runs-on: ubuntu-latest
outputs:
version: ${{ env.VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Get latest tag
id: get-latest-tag
uses: actions-ecosystem/action-get-latest-tag@v1
with:
semver_only: true
- uses: actions-ecosystem/action-bump-semver@v1
id: bump-semver
with:
current_version: ${{ steps.get-latest-tag.outputs.tag }}
level: patch
- name: Set VERSION variable
if: env.VERSION == '' && github.event_name == 'workflow_dispatch'
run: echo VERSION=${{ steps.bump-semver.outputs.new_version }} >> $GITHUB_ENV
- name: Force set VERSION variable
if: github.event.inputs.version != ''
run: echo VERSION=${{ github.event.inputs.version }} >> $GITHUB_ENV
deps:
needs: [version]
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.version.outputs.version }}
steps:
- name: Release hydro-serving-protos
if: github.event.inputs.skip_grpc == 'false'
uses: aurelien-baudet/[email protected]
with:
workflow: Release
token: ${{ secrets.HYDRO_SERVING_TOKEN }}
repo: ${{ github.repository_owner }}/hydro-serving-protos
inputs: '{"version": "${{ env.VERSION }}", "release": "global"}'
- name: Release hydro-serving-sdk
if: github.event.inputs.skip_sdk == 'false'
uses: aurelien-baudet/[email protected]
with:
workflow: Release
token: ${{ secrets.HYDRO_SERVING_TOKEN }}
repo: ${{ github.repository_owner }}/hydro-serving-sdk
inputs: '{"version": "${{ env.VERSION }}", "release": "global", "grpc_version": "${{ env.VERSION }}"}'
- name: Release hydro-serving-cli
if: github.event.inputs.skip_cli == 'false'
uses: aurelien-baudet/[email protected]
with:
workflow: Release
token: ${{ secrets.HYDRO_SERVING_TOKEN }}
repo: ${{ github.repository_owner }}/hydro-serving-cli
inputs: '{"version": "${{ env.VERSION }}", "release": "global", "sdk_version": "${{ env.VERSION }}"}'
- name: Release hydro-serving-python
if: github.event.inputs.skip_runtime == 'false'
uses: aurelien-baudet/[email protected]
with:
workflow: Release
token: ${{ secrets.HYDRO_SERVING_TOKEN }}
repo: ${{ github.repository_owner }}/hydro-serving-python
inputs: '{"version": "${{ env.VERSION }}", "release": "global", "sdk_version": "${{ env.VERSION }}"}'
Release_grpc_services:
# release all service repos in parallel
if: github.event.inputs.skip_services == 'false'
runs-on: ubuntu-latest
needs: [version, deps]
env:
VERSION: ${{ needs.version.outputs.version }}
strategy:
matrix:
service_grpc_repo_name: [hydro-serving-gateway, hydro-serving-manager, sonar]
steps:
- name: Release latest version of ${{ matrix.service_grpc_repo_name }}
uses: aurelien-baudet/[email protected]
with:
workflow: Release
token: ${{ secrets.HYDRO_SERVING_TOKEN }}
repo: ${{ github.repository_owner }}/${{ matrix.service_grpc_repo_name }}
inputs: '{"version": "${{ env.VERSION }}", "release": "global", "grpc_version": "${{ env.VERSION }}"}'
Release_sdk_services:
# release all service repos in parallel
if: github.event.inputs.skip_services == 'false'
runs-on: ubuntu-latest
needs: [version, deps]
env:
VERSION: ${{ needs.version.outputs.version }}
strategy:
matrix:
service_sdk_repo_name: [hydro-stat, hydro-visualization, hydro-root-cause, hydro-auto-od] # names of repositories to release
steps:
- name: Release latest version of ${{ matrix.service_sdk_repo_name }}
uses: aurelien-baudet/[email protected]
with:
workflow: Release
token: ${{ secrets.HYDRO_SERVING_TOKEN }}
repo: ${{ github.repository_owner }}/${{ matrix.service_sdk_repo_name }}
inputs: '{"version": "${{ env.VERSION }}", "release": "global", "sdk_version": "${{ env.VERSION }}"}'
Release_services:
# release all service repos in parallel
if: github.event.inputs.skip_services == 'false'
runs-on: ubuntu-latest
needs: [version, deps]
env:
VERSION: ${{ needs.version.outputs.version }}
strategy:
matrix:
service_repo_name: [hydro-serving-ui]
steps:
- name: Release latest version of ${{ matrix.service_repo_name }}
uses: aurelien-baudet/[email protected]
with:
workflow: Release
token: ${{ secrets.HYDRO_SERVING_TOKEN }}
repo: ${{ github.repository_owner }}/${{ matrix.service_repo_name }}
inputs: '{"version": "${{ env.VERSION }}", "release": "global"}'
Release_serving:
needs: [version, Release_services, Release_sdk_services, Release_grpc_services]
if: github.event.inputs.skip_release == 'false'
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- env:
IMAGE: serving-gateway
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
release: global
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- env:
IMAGE: serving-manager
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
release: global
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- env:
IMAGE: hydro-root-cause
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
release: global
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- env:
IMAGE: sonar
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
release: global
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- env:
IMAGE: hydro-stat
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
release: global
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- env:
IMAGE: hydro-serving-ui
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
release: global
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- env:
IMAGE: hydro-visualization
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
release: global
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- env:
IMAGE: hydro-auto-od
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
release: global
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- uses: azure/setup-helm@v1
id: install
# Bump chart version
- name: Update Umbrella helm chart version
env:
sedVersion: 's/^version.*/version: ${{ env.VERSION }}/g'
sedAppVersion: 's/^appVersion.*/appVersion: ${{ env.VERSION }}/g'
run: |
sed -i -e "$sedVersion" helm/serving/Chart.yaml
sed -i -e "$sedAppVersion" helm/serving/Chart.yaml
- name: Show chart version
run: cat helm/serving/Chart.yaml
- name: Lint helm
run: |
cd helm/serving
helm dep up
helm template .
- name: Create helm release
run: |
cd helm
helm package --dependency-update --version ${{ env.VERSION }} serving
- name: Calculate release sha
id: sha
run: |
cd helm
SHA=$(shasum -a 256 -b ./serving-${{ env.VERSION }}.tgz | awk '{ print $1 }')
echo ::set-output name=sha::$SHA
- name: Update README.md
run: |
sed -i -E "s/export HYDROSPHERE_RELEASE=.*/export HYDROSPHERE_RELEASE=${{ env.VERSION }}/g" README.md
- name: Update helm/README.md
env:
sedCommand: 's/[0-9]+\.[0-9]+\.[0-9]+\/serving-[0-9]+\.[0-9]+\.[0-9]+\.tgz/${{ env.VERSION }}\/serving-${{ env.VERSION }}.tgz/g'
run: |
echo $sedCommand
cd helm
sed -i 'README.md' -E -e $sedCommand README.md
- name: Add release metadata to helm/index.yaml
run: |
cd helm
./add_version.sh ${{ env.VERSION }} ${{ steps.sha.outputs.sha }}
- name: Push changes
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
sudo chown -R "${USER:-$(id -un)}" .
git commit -m "Releasing global version ${{ env.VERSION }}" -a --allow-empty
git push
- name: Create github release
uses: meeDamian/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.VERSION }}
gzip: false
files: helm/serving-${{ env.VERSION }}.tgz
- name: Update helm chart repo index
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .
slackNotification:
name: Slack Notification
env:
VERSION: ${{ needs.version.outputs.version }}
needs: Release_serving
runs-on: ubuntu-latest
steps:
- name: Slack Notification success
if: ${{ success() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: hydrosphere
SLACK_USERNAME: HydroRobot
SLACK_ICON: https://avatars.githubusercontent.com/u/17550625?s=200&v=4
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: Build status - success
SLACK_MESSAGE: "Congratulations! Global release Hydrosphere ${{ env.VERSION }} has happened :rocket:"
MSG_MINIMAL: true
- name: Slack Notification failure
if: ${{ failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: hydrosphere
SLACK_USERNAME: HydroRobot
SLACK_ICON: https://avatars.githubusercontent.com/u/17550625?s=200&v=4
SLACK_COLOR: ${{ job.status }}
SLACK_TITLE: Build status - failure
SLACK_MESSAGE: "Check global release build status"
MSG_MINIMAL: true