Merge pull request #78 from pirogramming/dev #31
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 to Healthtant Server | |
| on: | |
| push: | |
| branches: ["main"] # main 브랜치에 push될 때 실행 | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Set up SSH | |
| uses: webfactory/[email protected] | |
| with: | |
| ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
| # USERNAME과 HOST 확인용 디버그 스텝 | |
| - name: Debug Secrets | |
| run: | | |
| echo "USERNAME is set to: ${{ secrets.USERNAME }}" | |
| echo "HOST is set to: ${{ secrets.HOST }}" | |
| # SSH 접속 테스트 (-vvv 옵션으로 디버깅) | |
| - name: Test SSH Connection | |
| run: | | |
| ssh -vvv -o StrictHostKeyChecking=no ${{ secrets.USERNAME }}@${{ secrets.HOST }} exit | |
| - name: Deploy to server | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ secrets.USERNAME }}@${{ secrets.HOST }} << 'EOF' | |
| cd ~/Healthtant | |
| git pull origin main | |
| docker-compose down | |
| docker-compose up -d --build | |
| docker-compose exec -T web python manage.py migrate | |
| docker-compose exec -T web python manage.py collectstatic --noinput | |
| EOF |