Deploy Production #15
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: Deploy Production | |
| on: | |
| workflow_run: | |
| workflows: ["Deploy Frontend", "Deploy Backend"] # 프론트엔드와 백엔드 배포가 완료된 후 실행 | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} # 이전 워크플로우가 성공한 경우에만 실행 | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v3 | |
| - name: Check SERVER_IP | |
| run: echo "SERVER_IP = ${{ secrets.SERVER_IP }}" | |
| - name: Deploy to Production | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.SERVER_IP }} | |
| username: ${{ secrets.SERVER_USER }} | |
| password: ${{ secrets.SERVER_PASSWORD }} | |
| script: | | |
| cd /root/TUK-cbu-manage/DevOps | |
| docker-compose -f docker-compose.prod.yml down # 기존 컨테이너 중지 | |
| docker-compose -f docker-compose.prod.yml up --build -d # 전체 서비스 재시작 |