-
Notifications
You must be signed in to change notification settings - Fork 0
304 lines (258 loc) · 8.94 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
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_manager:
description: 'Skip manager?'
type: boolean
default: 'false'
required: false
skip_plugins:
description: 'Skip plugins?'
type: boolean
default: 'false'
required: false
skip_ui:
description: 'Skip ui?'
type: boolean
default: 'false'
required: false
skip_release:
description: 'Skip release?'
type: boolean
default: 'false'
required: false
skip_slack:
description: 'Skip slack notification?'
type: boolean
default: 'false'
required: false
env:
DOCKER_REGISTRY_URL: hydrosphere
# Secrets:
# HYDRO_SERVING_TOKEN - github token with write access to all hydrosphere repos
defaults:
run:
shell: bash
jobs:
version:
name: 'Determine release version'
runs-on: ubuntu-20.04
outputs:
version: ${{ env.VERSION }}
steps:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Get the 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: ${{ github.event.inputs.bump }}
- 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
manager_release:
if: github.event.inputs.skip_manager == 'false'
needs: version
name: 'Release manager'
runs-on: ubuntu-20.04
env:
VERSION: ${{ needs.version.outputs.version }}
steps:
- name: Release monitoring-manager
uses: aurelien-baudet/[email protected]
with:
workflow: Release
token: ${{ secrets.HYDRO_SERVING_TOKEN }}
repo: ${{ github.repository_owner }}/monitoring-manager
ref: master
inputs: '{"version": "${{ env.VERSION }}"}'
plugins_release:
if: github.event.inputs.skip_plugins == 'false'
needs: version
name: 'Release plugins'
runs-on: ubuntu-20.04
env:
VERSION: ${{ needs.version.outputs.version }}
strategy:
matrix:
plugin_repo_name: [hydro-profiler, drift-report-plugin]
steps:
- name: Release ${{ matrix.plugin_repo_name }}
uses: aurelien-baudet/[email protected]
with:
workflow: Release
token: ${{ secrets.HYDRO_SERVING_TOKEN }}
repo: ${{ github.repository_owner }}/${{ matrix.plugin_repo_name }}
ref: master
inputs: '{"version": "${{ env.VERSION }}"}'
ui_release:
if: github.event.inputs.skip_ui == 'false'
needs: version
name: 'Release ui'
runs-on: ubuntu-20.04
env:
VERSION: ${{ needs.version.outputs.version }}
steps:
- name: Release shell-ui
uses: aurelien-baudet/[email protected]
with:
workflow: Release
token: ${{ secrets.HYDRO_SERVING_TOKEN }}
repo: ${{ github.repository_owner }}/hydroserving-shell-ui
ref: master
inputs: '{"version": "${{ env.VERSION }}"}'
monitoring_release:
needs: [version, manager_release, plugins_release, ui_release]
if: |
always() &&
(needs.version.result == 'success') &&
(needs.manager_release.result == 'success' || needs.manager_release.result == 'skipped') &&
(needs.plugins_release.result == 'success' || needs.plugins_release.result == 'skipped') &&
(needs.ui_release.result == 'success' || needs.ui_release.result == 'skipped') &&
(github.event.inputs.skip_release == 'false')
name: 'Release hydro-monitoring'
runs-on: ubuntu-20.04
env:
VERSION: ${{ needs.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v2
- env:
IMAGE: monitoring-manager
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- env:
IMAGE: profiler
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- env:
IMAGE: drift-report-plugin
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
registry_url: ${{ env.DOCKER_REGISTRY_URL }}
service_image_name: ${{ env.IMAGE }}
tag: ${{ env.VERSION }}
- env:
IMAGE: shell-ui
name: Bump $IMAGE version in chart
uses: ./.github/actions/release-action
with:
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/monitoring/Chart.yaml
sed -i -e "$sedAppVersion" helm/monitoring/Chart.yaml
- name: Show chart version
run: cat helm/monitoring/Chart.yaml
- name: Lint helm
run: |
cd helm/monitoring
helm dep up
helm template .
- name: Create helm release
run: |
cd helm
helm package --dependency-update --version ${{ env.VERSION }} monitoring
- name: Calculate release sha
id: sha
run: |
cd helm
SHA=$(shasum -a 256 -b ./monitoring-${{ env.VERSION }}.tgz | awk '{ print $1 }')
echo ::set-output name=sha::$SHA
- name: Update README.md
run: |
sed -i -E "s/export HYDRO_MONITORING_RELEASE=.*/export HYDRO_MONITORING_RELEASE=${{ env.VERSION }}/g" 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/monitoring-${{ env.VERSION }}.tgz
- name: Update helm chart repo index
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .
slack_notification:
if: github.event.inputs.skip_slack == 'false'
needs: monitoring_release
name: Slack Notification
env:
VERSION: ${{ needs.version.outputs.version }}
runs-on: ubuntu-20.04
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 Hydro-monitoring ${{ 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 Hydro-monitoring ${{ env.VERSION }} build status"
MSG_MINIMAL: true