refactor(deploy): integrate with shared Caddy, add migrations to entr… #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: Deploy to 7demo | |
| on: | |
| push: | |
| branches: [main] | |
| paths-ignore: | |
| - 'docs/**' | |
| - '**.md' | |
| - '.gitignore' | |
| workflow_dispatch: {} | |
| concurrency: | |
| group: deploy-main | |
| cancel-in-progress: false | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: Configure SSH | |
| run: | | |
| mkdir -p ~/.ssh | |
| echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key | |
| chmod 600 ~/.ssh/deploy_key | |
| ssh-keyscan -H "${{ secrets.DEPLOY_HOST }}" >> ~/.ssh/known_hosts | |
| - name: Deploy | |
| env: | |
| SSH_USER: ${{ secrets.DEPLOY_USER }} | |
| SSH_HOST: ${{ secrets.DEPLOY_HOST }} | |
| run: | | |
| ssh -i ~/.ssh/deploy_key "$SSH_USER@$SSH_HOST" bash <<'EOF' | |
| set -euo pipefail | |
| cd /opt/oltinpay | |
| git fetch --prune origin | |
| git reset --hard origin/main | |
| docker compose pull || true | |
| docker compose up -d --build | |
| docker image prune -f || true | |
| EOF |