Merge pull request #8 from prinzpiuz/infra_setup #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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "public/**" | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up SSH | |
| uses: webfactory/ssh-agent@v0.9.1 | |
| with: | |
| ssh-private-key: ${{ secrets.VPS_SSH_KEY }} | |
| - name: Copy files to Server | |
| run: | | |
| rsync -avz --delete \ | |
| --filter='P /.env' \ | |
| --filter='P /caddy_data/' \ | |
| --filter='P /caddy_config/' \ | |
| ./public/ ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }}:~/Druv/ | |
| env: | |
| RSYNC_RSH: "ssh -o StrictHostKeyChecking=no" | |
| - name: Deploy on Server | |
| run: | | |
| ssh -o StrictHostKeyChecking=no ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} << 'EOF' | |
| cd ~/Druv/ | |
| docker compose pull | |
| docker compose up -d --remove-orphans | |
| EOF |