Skip to content

Merge branch 'master' of https://github.com/SystemConsultantGroup/SCG… #40

Merge branch 'master' of https://github.com/SystemConsultantGroup/SCG…

Merge branch 'master' of https://github.com/SystemConsultantGroup/SCG… #40

Workflow file for this run

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"