-
Notifications
You must be signed in to change notification settings - Fork 16
380 lines (356 loc) · 13.4 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
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
---
name: Release
on:
push:
# TODO: delete once ready to merge
branches:
- EVEREST-726-release-workflow
# TODO: uncomment once ready to merge
# workflow_dispatch:
# inputs:
# version:
# description: "The RC/Release version, format: X.Y.Z-rcN for RC, X.Y.Z for releases"
# required: true
permissions:
contents: read
packages: write
checks: write
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
env:
TOOLS_PATH: "/opt/tools/bin"
# TODO: uncomment once ready to merge
#VERSION: ${{ github.event.inputs.version }}
# TODO: delete this line once ready to merge
VERSION: 100.100.100-rc100
# version in format "X.Y" which is going to be updated with each patch release
FLOATING_TAG: ''
# branch name in format "release-X.Y"
BRANCH_NAME: ''
# GitHub tag name to use for the RC/Release
GH_TAG: ''
# Shows if this workflow is triggered for RC or Release
IS_RC: 0
ARCH: ''
OS: ''
steps:
- name: Validate input
run: |
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-rc[1-9][0-9]*)?$ ]]; then
echo "Wrong version format provided, please use "X.Y.Z-rcN" format for an RC or "X.Y.Z" format for a release"
exit 1
fi
- name: Set environment variables
run: |
floating_tag=${VERSION%.*}
echo "FLOATING_TAG=$floating_tag" >> $GITHUB_ENV
echo "BRANCH_NAME=release-$floating_tag" >> $GITHUB_ENV
echo "GH_TAG=v$VERSION" >> $GITHUB_ENV
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "IS_RC=1" >> $GITHUB_ENV
fi
echo "ARCH=$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/')" >> $GITHUB_ENV
echo "OS=$(uname | awk '{print tolower($0)}')" >> $GITHUB_ENV
# - name: Operator - check out
# uses: actions/checkout@v4
# with:
# repository: percona/everest-operator
# path: everest-operator
# token: ${{ secrets.ROBOT_TOKEN }}
#
# - name: Operator - create release branch
# run: |
# cd everest-operator
# # Check if the branch already exists
# git fetch
# check_branch=$(git ls-remote --heads origin ${BRANCH_NAME})
# if [[ -z ${check_branch} ]]; then
# git checkout -b $BRANCH_NAME
# git push origin $BRANCH_NAME
# fi
#
# git checkout $BRANCH_NAME
#
# # update version in the Makefile
# sed -i "s/^VERSION ?=.*/VERSION ?= $VERSION/g" Makefile
#
# make init
# make release
#
# # if there is something to commit, commit it and add the tag
# if [[ -n $(git status --porcelain) ]]; then
# if git tag --list | grep -q "^$GH_TAG$"; then
# echo "The tag is already present in github. Please create a different RC/Release"
# exit 1
# fi
#
# # configure userdata for commits
# git config --global user.email "[email protected]"
# git config --global user.name "Everest RC CI triggered by ${{ github.actor }}"
#
# echo "---"
# git diff
# echo "---"
#
# # commit and push the updated files
# git commit -a -m "update version tag"
# git push origin $BRANCH_NAME
# # TODO: uncomment once ready to merge
# # git tag $GH_TAG
# # git push origin $GH_TAG
# fi
#
#
# - name: Operator - install operator-sdk
# run: |
# mkdir -p $TOOLS_PATH
# echo $TOOLS_PATH >> $GITHUB_PATH
#
# export OPERATOR_SDK_DL_URL=https://github.com/operator-framework/operator-sdk/releases/download/v1.25.2
# curl -LO ${OPERATOR_SDK_DL_URL}/operator-sdk_${OS}_${ARCH}
#
# gpg --keyserver keyserver.ubuntu.com --recv-keys 052996E2A20B5C7E
#
# curl -LO ${OPERATOR_SDK_DL_URL}/checksums.txt
# curl -LO ${OPERATOR_SDK_DL_URL}/checksums.txt.asc
# gpg -u "Operator SDK (release) <[email protected]>" --verify checksums.txt.asc
#
# grep operator-sdk_${OS}_${ARCH} checksums.txt | sha256sum -c -
#
# chmod +x operator-sdk_${OS}_${ARCH}
# mv operator-sdk_${OS}_${ARCH} $TOOLS_PATH/operator-sdk
#
# - name: Operator - build and bundle
# run: |
# cd everest-operator
# make build manifests bundle
#
#
# - name: Operator - setup Docker meta for everest-operator
# id: operator_meta
# uses: docker/metadata-action@v4
# # docker/metadata-action action looks more elegant when being triggered by a GH tag,
# # however this workflow can't be triggered by a GH tag since there are some changes need to be done
# # in the codebase prior putting the tag, so the action uses the raw tags
# with:
# images: |
# percona/everest-operator,enable=${{ env.IS_RC == 0 }}
# perconalab/everest-operator
# tags: |
# type=raw,value=${{ env.VERSION }}
# type=raw,value=${{ env.FLOATING_TAG }},enable=${{ env.IS_RC == 0 }}
#
# - name: Operator - setup Docker meta for everest-operator-bundle
# id: bundle_meta
# uses: docker/metadata-action@v4
# with:
# images: |
# percona/everest-operator-bundle,enable=${{ env.IS_RC == 0 }}
# perconalab/everest-operator-bundle
# tags: |
# type=raw,value=${{ env.VERSION }}
# type=raw,value=${{ env.FLOATING_TAG }},enable=${{ env.IS_RC == 0 }}
#
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKERHUB_USERNAME }}
# password: ${{ secrets.DOCKERHUB_TOKEN }}
#
# - name: Operator - build and push operator everest-operator image
# uses: docker/build-push-action@v3
# with:
# context: everest-operator
# # TODO: uncomment once ready to merge
# push: false
# # push: true
# tags: ${{ steps.operator_meta.outputs.tags }}
#
# - name: Operator - build and push everest-operator-bundle image
# uses: docker/build-push-action@v3
# with:
# context: everest-operator
# push: false
# # push: true
# tags: ${{ steps.bundle_meta.outputs.tags }}
# file: everest-operator/bundle.Dockerfile
#
# - name: Catalog - checkout
# uses: actions/checkout@v4
# with:
# repository: percona/everest-catalog
# path: everest-catalog
# token: ${{ secrets.ROBOT_TOKEN }}
#
# - name: Catalog - create release branch
# run: |
# cd everest-catalog
# # Check if the branch already exists
# git fetch
# check_branch=$(git ls-remote --heads origin ${BRANCH_NAME})
#
# if [[ -z ${check_branch} ]]; then
# git checkout -b $BRANCH_NAME
# git push origin $BRANCH_NAME
# fi
# git checkout $BRANCH_NAME
#
# # update tag refs in scripts
# if [[ $env.IS_RC ]]; then
# sed -i "s/perconalab\/everest-operator-bundle.*/perconalab\/everest-operator-bundle:$VERSION/g" catalog/everest-operator/veneer.yaml
# sed -i "s/percona\/everest-operator-bundle.*/perconalab\/everest-operator-bundle:$VERSION/g" catalog/everest-operator/veneer.yaml
# else
# sed -i "s/perconalab\/everest-operator-bundle.*/percona\/everest-operator-bundle:$VERSION/g" catalog/everest-operator/veneer.yaml
# sed -i "s/percona\/everest-operator-bundle.*/percona\/everest-operator-bundle:$VERSION/g" catalog/everest-operator/veneer.yaml
# fi
#
# curl -Lo /tmp/opm https://github.com/operator-framework/operator-registry/releases/latest/download/${OS}-${ARCH}-opm
# chmod +x /tmp/opm
# /tmp/opm alpha render-template semver -o yaml < ./catalog/everest-operator/veneer.yaml > ./catalog/everest-operator/catalog.yaml
#
# # if there is something to commit, commit it and add the tag
# if [[ -n $(git status --porcelain) ]]; then
# if git tag --list | grep -q "^$GH_TAG$"; then
# echo "The tag is already present in github. Please create a different RC/Release"
# exit 1
# fi
#
# # configure userdata for commits
# git config --global user.email "[email protected]"
# git config --global user.name "Everest RC CI triggered by ${{ github.actor }}"
#
# echo "---"
# git diff
# echo "---"
#
# # commit and push the updated files
# git commit -a -m "update version tag"
# git push origin $BRANCH_NAME
# # TODO: uncomment once ready to merge
# # git tag $GH_TAG
# # git push origin $GH_TAG
# fi
#
#
# - name: Catalog - docker meta
# id: catalog_meta
# uses: docker/metadata-action@v4
# with:
# images: |
# percona/everest-catalog,enable=${{ env.IS_RC == 0 }}
# perconalab/everest-catalog
# tags: |
# type=raw,value=${{ env.VERSION }}
# type=raw,value=latest
# type=raw,value=${{ env.FLOATING_TAG }},enable=${{ env.IS_RC == 0 }}
#
#
# - name: Catalog - build and push image
# uses: docker/build-push-action@v3
# with:
# context: everest-catalog
# # TODO: uncomment once ready to merge
# push: false
# # push: true
# tags: ${{ steps.catalog_meta.outputs.tags }}
# file: everest-catalog/everest-catalog.Dockerfile
- name: Everest - check out
uses: actions/checkout@v4
with:
token: ${{ secrets.ROBOT_TOKEN }}
- name: Everest - create and update release branch
run: |
# Check if the branch already exists
git fetch
check_branch=$(git ls-remote --heads origin ${BRANCH_NAME})
if [[ -z ${check_branch} ]]; then
git checkout -b $BRANCH_NAME
# git push origin $BRANCH_NAME
fi
git checkout $BRANCH_NAME
# Update deploy manifest
if [[ $env.IS_RC ]]; then
sed -i "s/perconalab\/everest.*/perconalab\/everest:$VERSION/g" deploy/quickstart-k8s.yaml
sed -i "s/percona\/percona-everest.*/perconalab\/everest:$VERSION/g" deploy/quickstart-k8s.yaml
else
sed -i "s/perconalab\/everest.*/percona\/percona-everest:$VERSION/g" deploy/quickstart-k8s.yaml
sed -i "s/percona\/percona-everest.*/percona\/percona-everest:$VERSION/g" deploy/quickstart-k8s.yaml
fi
# Update the operator go module to reference the version tag
# go get github.com/percona/everest-operator@$GH_TAG
# go mod tidy
# Change version in Makefile
sed -i "s/RELEASE_VERSION ?=.*/RELEASE_VERSION ?= v$VERSION/g" Makefile
# if there is something to commit, commit it and add the tag
if [[ -n $(git status --porcelain) ]]; then
if git tag --list | grep -q "^$GH_TAG$"; then
echo "The tag is already present in github. Please create a different RC/Release"
exit 1
fi
# configure userdata for commits
git config --global user.email "[email protected]"
git config --global user.name "Everest RC CI triggered by ${{ github.actor }}"
echo "---"
git diff
echo "---"
# commit and push the updated files
git commit -a -m "update version tag"
git push origin $BRANCH_NAME
# TODO: uncomment once ready to merge
# git tag $GH_TAG
# git push origin $GH_TAG
fi
- name: Everest UI - setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8
- name: Everest UI - run with Node 20
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
cache-dependency-path: ui/pnpm-lock.yaml
- name: Everest UI - build
run: |
cd ui
pnpm install
EVEREST_OUT_DIR=${GITHUB_WORKSPACE}/public/dist/ pnpm build
- name: Everest - setup golang
uses: actions/setup-go@v5
with:
go-version-file: './go.mod'
- name: Everest - build binary
run: |
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 make build
- name: Everest - setup docker build metadata
uses: docker/metadata-action@v5
id: everest_meta
with:
images: |
percona/percona-everest,enable=${{ env.IS_RC == 0 }}
perconalab/everest
tags: |
type=raw,value=${{ env.VERSION }}
type=raw,value=latest
type=raw,value=${{ env.FLOATING_TAG }},enable=${{ env.IS_RC == 0 }}
- name: Everest - build and push Everest image
uses: docker/build-push-action@v5
with:
context: .
# TODO: uncomment once ready to merge
push: false
# push: true
tags: ${{ steps.everest_meta.outputs.tags }}
- name: CLI - build binaries
run: |
make release-cli
- name: CLI - create release with binaries
uses: softprops/action-gh-release@v1
with:
draft: true
files: |
dist/*
env:
GITHUB_TOKEN: ${{ github.token }}