Bug fix #7
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: CD | |
| on: | |
| push: | |
| branches: ["main"] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout (optional) | |
| uses: actions/checkout@v4 | |
| - name: Deploy via SSH | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.DEPLOY_HOST }} | |
| username: ${{ secrets.DEPLOY_USER }} | |
| key: ${{ secrets.DEPLOY_SSH_KEY }} | |
| port: ${{ secrets.DEPLOY_PORT || 22 }} | |
| script: | | |
| set -e | |
| cd ${{ secrets.DEPLOY_PATH }} | |
| # Get latest code | |
| git fetch --all | |
| git reset --hard origin/main | |
| # Build + run prod stack | |
| docker compose -f docker-compose.prod.yml pull || true | |
| docker compose -f docker-compose.prod.yml up -d --build | |
| # Optional: cleanup old images | |
| docker image prune -f |