-
Notifications
You must be signed in to change notification settings - Fork 487
311 lines (286 loc) · 10.6 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
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
name: Release
permissions: read-all
# contents: read
on:
workflow_dispatch:
inputs:
commit:
required: false
description: 'Fluvio git commit override (latest `master` by default)'
default: ''
installer_version:
required: false
description: ''
default: ''
pre_release:
type: boolean
required: true
description: ''
default: true
workflow_call:
inputs:
commit:
required: false
type: string
description: 'Fluvio git commit override (latest `master` by default)'
default: ''
installer_version:
required: false
type: string
description: 'The version of Fluvio to download with install.sh'
default: 'stable'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE: true # Needed so `make` targets make public changes
jobs:
cd_dev_check:
name: CD_Dev check
strategy:
fail-fast: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Get status of latest CD_Dev run
id: cd_dev_check
run: make latest-cd-dev-status
setup_job:
name: Setup workflow
needs: [cd_dev_check]
runs-on: ubuntu-latest
outputs:
VERSION: ${{ steps.version_step.outputs.VERSION }}
TARGET_SHA: ${{ steps.version_step.outputs.GIT_SHA }}
INSTALLER_URL: ${{ steps.installer_step.outputs.INSTALLER_URL }}
steps:
- name: Set target sha and Fluvio version
id: version_step
run: |
if [[ -z "${{ github.event.inputs.commit }}" ]]; then
export GITHUB_VERSION=$(curl -fsS https://raw.githubusercontent.com/infinyon/fluvio/${{ github.sha }}/VERSION)
echo "VERSION=${GITHUB_VERSION}" | tee -a $GITHUB_ENV
echo "VERSION=${GITHUB_VERSION}" >> $GITHUB_OUTPUT
echo "GIT_SHA=${{ github.sha }}" | tee -a $GITHUB_ENV
echo "GIT_SHA=${{ github.sha }}" >> $GITHUB_OUTPUT
else
export GITHUB_VERSION=$(curl -fsS https://raw.githubusercontent.com/infinyon/fluvio/${{ github.event.inputs.commit }}/VERSION)
echo "VERSION=${GITHUB_VERSION}" | tee -a $GITHUB_ENV
echo "VERSION=${GITHUB_VERSION}" >> $GITHUB_OUTPUT
echo "GIT_SHA=${{ github.event.inputs.commit }}" | tee -a $GITHUB_ENV
echo "GIT_SHA=${{ github.sha }}" >> $GITHUB_OUTPUT
fi
- name: Set Installer URL
id: installer_step
run: |
echo "INSTALLER_URL=https://raw.githubusercontent.com/infinyon/fluvio/${{ steps.version_step.outputs.GIT_SHA }}/install.sh" >> $GITHUB_OUTPUT
- name: Slack Notification
uses: 8398a7/action-slack@v3
if: failure()
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
release_installer:
name: Release Fluvio Installer
needs: [setup_job]
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ORG_AWS_PKG_USER_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ORG_AWS_PKG_USER_SECRET_KEY }}
AWS_DEFAULT_REGION: us-west-2
TARGET_SHA: ${{ needs.setup_job.outputs.TARGET_SHA }}
INSTALLER_URL: ${{ needs.setup_job.outputs.INSTALLER_URL }}
steps:
- uses: actions/checkout@v4
- name: Download install.sh
run: curl -sSO $INSTALLER_URL
- name: Push install.sh to packages S3 bucket
run: make update-public-installer-script-s3
# Check for Github Release
release_github:
name: Release Fluvio to GitHub Release
needs: [setup_job]
runs-on: ubuntu-latest
permissions: write-all
env:
VERSION: ${{ needs.setup_job.outputs.VERSION }}
steps:
- uses: actions/checkout@v4
# Check that this release does not already exist by trying to download it
- name: Attempt to download release by version number
id: release_check
continue-on-error: true
env:
GH_RELEASE_TAG: v${{ env.VERSION }}
run: make download-fluvio-release
# If this release does not already exist (i.e. the release_check failed), create it
- name: Download artifacts from dev
if: ${{ steps.release_check.outcome == 'failure' }}
env:
GH_RELEASE_TAG: dev
run: make download-fluvio-release
# Release conventions expect the top-most release in CHANGELOG.md to be the version we're releasing
# The date is expected to be UNRELEASED, which we will replace with the current date
- name: Create GH Release with release notes
if: ${{ steps.release_check.outcome == 'failure' }}
env:
CHANNEL_TAG: ${{ env.VERSION }}
PRE_RELEASE: ${{ github.event.inputs.pre_release }}
run: make create-gh-release
- name: Slack Notification
uses: 8398a7/action-slack@v3
if: failure()
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
## Check for docker image
release_docker:
name: Release Docker Image
needs: [setup_job]
runs-on: ubuntu-latest
env:
VERSION: ${{ needs.setup_job.outputs.VERSION }}
TARGET_SHA: ${{ needs.setup_job.outputs.TARGET_SHA }}
steps:
- uses: actions/checkout@v4
- name: Attempt to pull image tag in docker registry
id: docker_check
continue-on-error: true
env:
DOCKER_IMAGE_TAG: ${{ env.VERSION }}
run: |
make docker-hub-check-image-exists
# if the check fails, then continue
# push both the versioned image, and update the stable tag
- name: Tag and push release images
if: ${{ steps.docker_check.outcome == 'failure' }}
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_IMAGE_TAG: ${{ env.VERSION }}
CHANNEL_TAG: stable
DEV_VERSION_TAG: ${{ env.VERSION }}-${{ env.TARGET_SHA }}
run: |
make docker-push-manifest
DOCKER_IMAGE_TAG=stable make docker-push-manifest
- name: Slack Notification
uses: 8398a7/action-slack@v3
if: failure()
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
# Check for Fluvio CLI
release_fluvio:
name: Release Fluvio CLI package
needs: [setup_job]
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ORG_AWS_PKG_USER_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ORG_AWS_PKG_USER_SECRET_KEY }}
VERSION: ${{ needs.setup_job.outputs.VERSION }}
INSTALLER_URL: ${{ needs.setup_job.outputs.INSTALLER_URL }}
BPKG_TOKEN: ${{ secrets.BPKG_TOKEN }}
steps:
- uses: actions/checkout@v4
# Check that this release does not already exist by trying to download it
- name: Attempt to install Fluvio CLI
id: check_fluvio
continue-on-error: true
env:
CHANNEL_TAG: ${{ env.VERSION }}
run: make curl-install-fluvio
# If this release does not already exist (i.e. check_fluvio failed), continue
- name: Install fluvio-package
env:
CHANNEL_TAG: stable # We want to ensure we install the stable version of CLI
run: |
make curl-install-fluvio
make install-fluvio-package
- name: Download dev release
if: ${{ steps.check_fluvio.outcome == 'failure' }}
env:
GH_RELEASE_TAG: dev
run: make download-fluvio-release
- name: Publish artifacts
if: ${{ steps.check_fluvio.outcome == 'failure' }}
env:
FLUVIO_BIN: ~/.fluvio/bin/fluvio
run: |
make publish-artifacts-stable
- name: Slack Notification
uses: 8398a7/action-slack@v3
if: ${{ !success() }}
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
# stable and latest channels are handled by bump-fluvio-stable and bump-fluvio-latest
# this is only intended to handle pre-release pkgsets
prerelease_pkgset:
name: Prerelease pkgset
needs: [release_fluvio]
runs-on: ubuntu-latest
if: ${{ inputs.pre_release }}
env:
BPKG_TOKEN: ${{ secrets.BPKG_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Prerelease pkgset ${{ env.FLUVIO_VERSION }}
run: |
make publish-pkgset
publish_crates:
name: Publish Crates
if: ${{ !inputs.pre_release }}
uses: ./.github/workflows/publish_crates.yml
with:
commit: ${{ github.event.inputs.commit }}
secrets: inherit
bump_stable_fluvio:
name: Bump stable Fluvio
needs: [setup_job, release_github, release_docker, release_fluvio]
#permissions: write-all
runs-on: ubuntu-latest
if: ${{ !inputs.pre_release }}
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ORG_AWS_PKG_USER_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ORG_AWS_PKG_USER_SECRET_KEY }}
VERSION: ${{ needs.setup_job.outputs.VERSION }}
TARGET_SHA: ${{ needs.setup_job.outputs.GIT_SHA }}
INSTALLER_URL: ${{ needs.setup_job.outputs.INSTALLER_URL }}
steps:
- uses: actions/checkout@v4
- name: Install fluvio-package
env:
CHANNEL_TAG: stable # We want to ensure we install the stable version of CLI
run: |
if [ -n "${{ github.event.inputs.installer_version }}" ]; then
export VERSION=${{ github.event.inputs.installer_version }}
echo "VERSION=$VERSION"
fi
make curl-install-fluvio
make install-fluvio-package
- name: Bump Fluvio CLI
# This should work until we support graceful failure
continue-on-error: true
env:
BPKG_TOKEN: ${{ secrets.BPKG_TOKEN }}
run: |
make bump-fluvio-stable
- name: Slack Notification
uses: 8398a7/action-slack@v3
if: failure()
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}