-
Notifications
You must be signed in to change notification settings - Fork 1
155 lines (137 loc) · 4.71 KB
/
deploy.yaml
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
name: deploy
on:
push:
branches:
- master
paths-ignore:
- 'deployment/**'
env:
frontend_dockerimage_tag: ${{ github.sha }}-frontend
backend_dockerimage_tag: ${{ github.sha }}-backend
frontend_dockerimage_name: scgskku/ask-fe
backend_dockerimage_name: scgskku/ask-be
jobs:
build-frontend:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: --------------- Code Repo (Frontend) ---------------
run: echo "Code Repo (Frontend)"
- name: Code Repo 불러오기 (Frontend)
uses: actions/checkout@v4
with:
repository: SystemConsultantGroup/SCG-Ask
ref: master
token: ${{ secrets.ACTION_TOKEN }}
- name: frontend 소스 복사
run: cp -r frontend/* .
- name: Docker 준비(1/4) - 메타데이터 생성 (Frontend)
id: meta-frontend
uses: docker/[email protected]
with:
images: |
${{ env.frontend_dockerimage_name }}
tags: |
${{ env.frontend_dockerimage_tag }}
latest
flavor: |
latest=true
- name: Docker 준비(2/4) - QEMU 설정 (Frontend)
uses: docker/setup-qemu-action@v2
- name: Docker 준비(3/4) - 빌더 설정 (Frontend)
uses: docker/setup-buildx-action@v2
- name: Docker 준비(4/4) - 로그인 (Frontend)
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker 빌드 및 푸시 (Frontend)
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta-frontend.outputs.tags }}
build-backend:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: --------------- Code Repo (Backend) ---------------
run: echo "Code Repo (Backend)"
- name: Code Repo 불러오기 (Backend)
uses: actions/checkout@v4
with:
repository: SystemConsultantGroup/SCG-Ask
ref: master
token: ${{ secrets.ACTION_TOKEN }}
- name: backend 소스 복사
run: cp -r backend/* .
- name: Docker 준비(1/4) - 메타데이터 생성 (Backend)
id: meta-backend
uses: docker/[email protected]
with:
images: |
${{ env.backend_dockerimage_name }}
tags: |
${{ env.backend_dockerimage_tag }}
latest
flavor: |
latest=true
- name: Docker 준비(2/4) - QEMU 설정 (Backend)
uses: docker/setup-qemu-action@v2
- name: Docker 준비(3/4) - 빌더 설정 (Backend)
uses: docker/setup-buildx-action@v2
- name: Docker 준비(4/4) - 로그인 (Backend)
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker 빌드 및 푸시 (Backend)
uses: docker/build-push-action@v4
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ steps.meta-backend.outputs.tags }}
deploy:
runs-on: ubuntu-latest
needs: [build-frontend, build-backend]
steps:
- name: --------------- Config Repo ---------------
run: echo "[Config Repo]"
- name: Config Repo 불러오기
uses: actions/checkout@v4
with:
repository: SystemConsultantGroup/SCG-Ask
ref: master
token: ${{ secrets.ACTION_TOKEN }}
path: SCG-Ask
- name: Kustomize 준비
uses: imranismail/[email protected]
- name: Config Repo 이미지 값 업데이트 (Frontend)
run: |
cd SCG-Ask/deployment/overlays/prod/fe/
kustomize edit set image ${{ env.frontend_dockerimage_name }}:${{ env.frontend_dockerimage_tag }}
cat kustomization.yaml
- name: Config Repo 이미지 값 업데이트 (Backend)
run: |
cd SCG-Ask/deployment/overlays/prod/be/
kustomize edit set image ${{ env.backend_dockerimage_name }}:${{ env.backend_dockerimage_tag }}
cat kustomization.yaml
- name: Config Repo 변경사항 푸시
run: |
cd SCG-Ask
git config --global user.email "[email protected]"
git config --global user.name "hynseok"
git commit -am "infra: Update image tag"
git push -u origin master
- name: --------------- Clean Up ---------------
run: echo "Clean Up"