feature: 클래스 리스트 페이지 기능 구현 (API MOCK) (#59) #73
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- frontend/** | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Docker Build | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v2 | |
with: | |
push: true | |
context: frontend | |
file: frontend/zicdding-class.com/Dockerfile | |
tags: ${{ secrets.DOCKER_USERNAME }}/zicdding-front:0.0.1 | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install SSH Client and sshpass | |
run: sudo apt-get update && sudo apt-get install -y openssh-client sshpass | |
- name: Add SSH key | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
# - name: Update targetRevision in application.yaml | |
# run: | | |
# sed -i "s|targetRevision:.*|targetRevision: main|" frontend/zicdding-class.com/k8s/manifests/application.yaml | |
- name: Execute ArgoCD commands on remote server | |
env: | |
SSH_HOST: ${{ secrets.SSH_HOST }} | |
SSH_PORT: ${{ secrets.SSH_PORT }} | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_PASSWORD: ${{ secrets.SSH_PASSWORD }} | |
ARGOCD_SERVER: ${{ secrets.ARGOCD_SERVER }} | |
ARGOCD_USERNAME: ${{ secrets.ARGOCD_USERNAME }} | |
ARGOCD_PASSWORD: ${{ secrets.ARGOCD_PASSWORD }} | |
run: | | |
sshpass -p $SSH_PASSWORD ssh -o StrictHostKeyChecking=no -t -p $SSH_PORT $SSH_USER@$SSH_HOST << EOF | |
argocd login ${ARGOCD_SERVER} --username ${ARGOCD_USERNAME} --password ${ARGOCD_PASSWORD} --insecure --plaintext --grpc-web-root-path /argocd || exit 1 | |
# 애플리케이션 생성 또는 업데이트 | |
argocd app create zicdding-front-app \ | |
--repo https://github.com/Zicdding/zicdding-class.git \ | |
--path frontend/zicdding-class.com/k8s/manifests \ | |
--dest-server https://kubernetes.default.svc \ | |
--dest-namespace default \ | |
--revision main \ | |
--sync-policy automated \ | |
--self-heal \ | |
--upsert || exit 1 | |
# 동기화 | |
argocd app sync zicdding-front-app --prune || exit 1 | |
# 동기화 완료될 때까지 대기 | |
argocd app wait zicdding-front-app --sync --timeout 300 || exit 1 | |
EOF |