-
Notifications
You must be signed in to change notification settings - Fork 1
175 lines (156 loc) 路 5.06 KB
/
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
name: Deploy to cluster
on:
push:
branches:
- main
- develop
jobs:
build-web:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
- name: Prepare image reference
run: echo "image_tag=sha-`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
- name: Prepare image metadata
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
${{ secrets.SCW_REGISTRY_ENDPOINT }}/web
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: nologin
password: ${{ secrets.SCW_SECRET_KEY }}
registry: ${{ secrets.SCW_REGISTRY_ENDPOINT }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
target: web-stable
# TODO: ends with 400
# cache-from: type=registry,ref=${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:buildcache
# cache-to: type=registry,ref=${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:buildcache,mode=max
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-proxy:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v3
- name: Prepare image metadata
id: meta
uses: docker/metadata-action@v4
with:
# list of Docker images to use as base name for tags
images: |
${{ secrets.SCW_REGISTRY_ENDPOINT }}/proxy
# generate Docker tags based on the following events/attributes
tags: |
type=ref,event=branch
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: nologin
password: ${{ secrets.SCW_SECRET_KEY }}
registry: ${{ secrets.SCW_REGISTRY_ENDPOINT }}
-
name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
target: proxy-stable
# TODO: ends with 400
# cache-from: type=registry,ref=${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:buildcache
# cache-to: type=registry,ref=${{ secrets.SCW_REGISTRY_ENDPOINT }}/web:buildcache,mode=max
cache-from: type=gha
cache-to: type=gha,mode=max
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
deploy:
runs-on: ubuntu-latest
concurrency: deploy
environment:
name: production
url: https://fiesta.plus
needs:
- build-web
- build-proxy
steps:
- uses: actions/checkout@v1
- name: Setup k8s context
run: |
echo "${{ secrets.KUBECONFIG }}" > kubeconfig.yaml
- name: Prepare image reference
run: echo "image_tag=sha-`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV
- name: Deploy
uses: 'vimeda/helm@v1.7.0'
with:
release: 'fiesta'
namespace: 'fiesta'
chart: 'charts'
token: '${{ github.token }}'
timeout: 120s
values: >-
web:
repository: ${{ secrets.SCW_REGISTRY_ENDPOINT }}/web
tag: ${{ env.image_tag }}
proxy:
repository: ${{ secrets.SCW_REGISTRY_ENDPOINT }}/proxy
tag: ${{ env.image_tag }}
ingress:
certContactEmail: ${{ secrets.CERT_CONTACT_EMAIL }}
secrets:
databaseUrl: ${{ secrets.DATABASE_URL }}
s3:
keyId: ${{ secrets.S3_KEY_ID }}
accessKey: ${{ secrets.S3_ACCESS_KEY }}
regionName: ${{ secrets.S3_REGION_NAME }}
bucketName: ${{ secrets.S3_BUCKET_NAME }}
dnsWebhook:
accessKey: ${{ secrets.SCW_DNS_ACCESS_KEY }}
secretKey: ${{ secrets.SCW_DNS_SECRET_KEY }}
value-files: >-
[
"charts/values.yaml"
]
env:
KUBECONFIG_FILE: '${{ secrets.KUBECONFIG }}'