어드민 폐업 추정 장소 화면 그리기 (#12) #49
This file contains 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: dev-ci-cd | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: # for manual trigger | |
permissions: | |
id-token: write | |
jobs: | |
ci: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: arn:aws:iam::291889421067:role/github-action-ci-cd | |
aws-region: ap-northeast-2 | |
- name: Build and Push Image | |
run: ./docker-push.sh dev | |
- name: Notify CI failure to slack | |
if: failure() | |
run: | | |
CURRENT_GITHUB_ACTION_RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"[DEV] Admin Frontend CI failed. (<$CURRENT_GITHUB_ACTION_RUN_URL|github action run url>)\"}" ${{ secrets.SLACK_URL_SCC_SERVER_CHANNEL }} -v | |
cd: | |
runs-on: ubuntu-latest | |
needs: | |
- ci | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install kubeconfig | |
env: | |
SCC_K3S_KUBECONFIG: ${{ secrets.SCC_K3S_KUBECONFIG }} | |
run: | | |
mkdir -p ~/.kube && echo "$SCC_K3S_KUBECONFIG" > ~/.kube/config | |
- uses: azure/setup-helm@v1 | |
with: | |
version: "3.8.2" | |
id: install-helm | |
- uses: azure/setup-kubectl@v3 | |
with: | |
version: "v1.24.1" | |
id: install-kubectl | |
- name: Upgrade scc-admin-frontend helm chart | |
working-directory: helm-chart/scc-admin-frontend | |
run: | | |
helm upgrade --install --namespace dev -f values-dev.yaml scc-admin-frontend ./ | |
- name: Restart deploy/scc-admin-frontend # tag를 latest-rc로 고정해서 사용하기 때문에 helm upgrade --install만 해서는 새 버전의 이미지가 배포되지 않는다. 따라서 강제로 rollout을 해준다. | |
run: | | |
kubectl rollout restart deploy/scc-admin-frontend -n dev | |
- name: Notify CD failure to slack | |
if: failure() | |
run: | | |
CURRENT_GITHUB_ACTION_RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"[DEV] scc-admin-frontend deployment failed. (<$CURRENT_GITHUB_ACTION_RUN_URL|github action run url>)\"}" ${{ secrets.SLACK_URL_SCC_SERVER_CHANNEL }} -v | |
- name: Notify CD success to slack | |
if: success() | |
run: | | |
CURRENT_GITHUB_ACTION_RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"[DEV] scc-admin-frontend with latest version is deployed!\"}" ${{ secrets.SLACK_URL_SCC_SERVER_CHANNEL }} -v |