This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
187 lines (157 loc) · 5.98 KB
/
rc.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
name: Build and push RC image
on:
workflow_dispatch:
inputs:
version:
description: The release version in v*.*.* format
required: true
push:
branches:
- release-[0-9]+.[0-9]+.[0-9]+*
- EVEREST-428-rc-pipeline # <-- DELETE ME before merge
jobs:
build:
runs-on: ubuntu-latest
env:
#VERSION: ${{ github.event.inputs.version }} # <-- UNCOMMENT ME before merge
VERSION: v100.100.100 # <-- DELETE ME before merge
RC_BRANCH: ''
steps:
- name: Validate input
run: |
echo $RC_BRANCH
if [[ ! $VERSION =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Wrong version format provided, please use v*.*.* format"
exit 1
fi
- name: Define release branch name in the format "release-*.*.*"
run: |
echo "RC_BRANCH=release-${VERSION#v}" >> $GITHUB_ENV
- name: Configure git for private modules
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: git config --global url."https://percona-platform-robot:${ROBOT_TOKEN}@github.com".insteadOf "https://github.com"
- name: Configure git user for commits
env:
ROBOT_TOKEN: ${{ secrets.ROBOT_TOKEN }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Everest RC CI"
- name: Check out Everest CLI
uses: actions/checkout@v4
with:
repository: percona/percona-everest-cli
ref: 'main'
path: percona-everest-cli
token: ${{ secrets.ROBOT_TOKEN }}
- name: Check out Everest CLI RC-branch
run: |
cd percona-everest-cli
# Check if the branch already exists
git fetch
check_branch=$(git ls-remote --heads origin ${RC_BRANCH})
if [[ -z ${check_branch} ]]; then
git checkout -b $RC_BRANCH
# git push origin $RC_BRANCH <--- UNCOMMENT ME once the permission granted to ROBOT_TOKEN
fi
- name: Check out Everest catalog
uses: actions/checkout@v4
with:
repository: percona/everest-catalog
ref: 'main'
path: everest-catalog
token: ${{ secrets.ROBOT_TOKEN }}
- name: Check out Everest catalog RC-branch
run: |
cd everest-catalog
# Check if the branch already exists
git fetch
check_branch=$(git ls-remote --heads origin ${RC_BRANCH})
if [[ -z ${check_branch} ]]; then
git checkout -b $RC_BRANCH
# git push origin $RC_BRANCH <--- UNCOMMENT ME once the permission granted to ROBOT_TOKEN
fi
- name: Check out Everest frontend
uses: actions/checkout@v4
with:
repository: percona/percona-everest-frontend
ref: 'main'
path: percona-everest-frontend
token: ${{ secrets.ROBOT_TOKEN }}
- name: Check out Everest Frontend RC-branch
run: |
cd percona-everest-frontend
# Check if the branch already exists
git fetch
check_branch=$(git ls-remote --heads origin ${RC_BRANCH})
if [[ -z ${check_branch} ]]; then
git checkout -b $RC_BRANCH
# git push origin $RC_BRANCH <--- UNCOMMENT ME once the permission granted to ROBOT_TOKEN
else
git checkout $RC_BRANCH
fi
- name: Run with Node 16
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install Bit Version Manager
run: npm i -g @teambit/bvm
- name: Install latest Bit version
run: bvm install 0.2.3
- name: Add bvm bin folder to path
run: echo "$HOME/bin" >> $GITHUB_PATH
- name: Set up bit config
env:
BIT_TOKEN: ${{ secrets.BIT_TOKEN }}
run: bit config set user.token $BIT_TOKEN
- name: Build Everest Frontend app
run: |
cd ${GITHUB_WORKSPACE}/percona-everest-frontend
bit install --recurring-install
bit snap
bit artifacts percona.apps/everest --out-dir build
mkdir ${GITHUB_WORKSPACE}/front
cp -rf build/percona.apps_everest/react-common-js/everest/public/* ${GITHUB_WORKSPACE}/front/
- name: Check out Everest Backend
uses: actions/checkout@v4
with:
path: ./backend
ref: 'main'
- name: Check out Everest Backend rc-branch
run: |
cd backend
# Check if the branch already exists
git fetch
check_branch=$(git ls-remote --heads origin ${RC_BRANCH})
if [[ -z ${check_branch} ]]; then
git checkout -b $RC_BRANCH
# update tag refs in scripts
sed -i "s/dev-latest/$RC_BRANCH/g" deploy/quickstart-compose.yml deploy/quickstart-k8s.yaml
git diff deploy/quickstart-compose.yml deploy/quickstart-k8s.yaml
# configure userdata for commits
git commit -a -m "update version tag"
git push origin $RC_BRANCH
else
git checkout $RC_BRANCH
fi
- name: Embed Everest Frontend app into backend
run: |
cp -rf ${GITHUB_WORKSPACE}/front/* ${GITHUB_WORKSPACE}/backend/public/dist/
cd ${GITHUB_WORKSPACE}/backend
- name: Setup docker build metadata
uses: docker/metadata-action@v4
id: meta
with:
images: perconalab/everest
tags: ${{ env.VERSION }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push everest RC-image
uses: docker/build-push-action@v4
with:
context: backend
push: true
tags: ${{ steps.meta.outputs.tags }}