-
Notifications
You must be signed in to change notification settings - Fork 17
199 lines (170 loc) · 6.06 KB
/
CI-CD-k8s-release-deploy.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
name: Deploy Gear-js to k8s prod
on:
push:
branches: ['stable']
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
jobs:
tag-prod-version:
runs-on: ubuntu-latest
environment: production
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Bump version and push tag
uses: sergeyfilyanin/github-tag-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INITIAL_VERSION: '1.0.0'
RELEASE_BRANCHES: stable
WITH_IDEA: true
build-frontend-image-prod:
runs-on: ubuntu-latest
needs: [tag-prod-version]
environment: production
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the github container registry
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Frontend Docker image
uses: docker/build-push-action@master
with:
file: idea/frontend/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-frontend:prod
build-args: |
VITE_NODE_ADDRESS=${{ secrets.REACT_APP_NODE_ADDRESS }}
VITE_API_URL=${{ secrets.REACT_APP_API_URL }}
VITE_DEFAULT_TRANSFER_BALANCE_VALUE=${{ secrets.REACT_APP_DEFAULT_TRANSFER_BALANCE_VALUE }}
VITE_HCAPTCHA_SITE_KEY=${{ secrets.REACT_APP_HCAPTCHA_SITE_KEY }}
VITE_NODES_API_URL=${{ secrets.REACT_APP_DEFAULT_NODES_URL }}
VITE_GTM_ID=${{ secrets.VITE_GTM_ID}}
VITE_MAINNET_VOUCHERS_API_URL=${{ secrets.VITE_MAINNET_VOUCHERS_API_URL }}
VITE_TESTNET_VOUCHERS_API_URL=${{ secrets.VITE_TESTNET_VOUCHERS_API_URL }}
VITE_DNS_API_URL=${{ secrets.VITE_DNS_API_URL }}
build-indexer-image-prod:
runs-on: ubuntu-latest
needs: [tag-prod-version]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the github container registry
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Indexer Docker image
uses: docker/build-push-action@master
with:
file: idea/indexer/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-indexer:prod
build-and-push-meta-storage-image:
runs-on: ubuntu-latest
needs: [tag-prod-version]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the github container registry
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Meta Storage Docker image
uses: docker/build-push-action@master
with:
file: idea/meta-storage/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-meta-storage:prod
build-api-gateway-image-prod:
runs-on: ubuntu-latest
needs: [tag-prod-version]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the github container registry
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Api Gateway Docker image
uses: docker/build-push-action@master
with:
file: idea/api-gateway/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-api-gateway:prod
build-test-balance-image-prod:
runs-on: ubuntu-latest
needs: [tag-prod-version]
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the github container registry
uses: docker/login-action@master
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Test Balance Docker image
uses: docker/build-push-action@master
with:
file: idea/test-balance/Dockerfile
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-test-balance:prod
deploy-to-k8s-prod:
needs:
[
build-frontend-image-prod,
build-and-push-meta-storage-image,
build-indexer-image-prod,
build-api-gateway-image-prod,
build-test-balance-image-prod,
]
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Deploy to k8s
uses: sergeyfilyanin/kubectl-aws-eks@master
with:
args: rollout restart deployment api-gateway indexer-testnet indexer-vara indexer-workshop test-balance-testnet frontend-nginx meta-storage -n prod-idea
- name: Check k8s deployments
uses: sergeyfilyanin/kubectl-aws-eks@master
with:
args: get deployment -o name -n prod-idea | xargs -n1 -t kubectl rollout status -n prod-idea --timeout=120s