Avoid conflicting Caddy service during deploy #2
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 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - Master | |
| concurrency: | |
| group: deploy-production | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| name: Deploy to server | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy over 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 }}" | |
| git fetch origin | |
| git checkout "${{ github.ref_name }}" | |
| git pull --ff-only origin "${{ github.ref_name }}" | |
| docker compose stop caddy || true | |
| docker compose rm -f caddy || true | |
| docker compose up -d --build mariadb php-app |