name: Deploy to VPS on: push: branches: - main workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: https://github.com/actions/checkout@v4 - uses: https://github.com/actions/setup-node@v4 with: node-version: "20" - run: npm ci --prefer-offline - run: npm run build deploy: needs: build runs-on: ubuntu-latest timeout-minutes: 45 steps: - uses: https://github.com/actions/checkout@v4 - uses: https://github.com/appleboy/ssh-action@v1.0.3 with: host: ${{ secrets.VPS_HOST }} username: ${{ secrets.VPS_USER }} key: ${{ secrets.VPS_SSH_KEY }} command_timeout: 30m script: | echo "=== START $(date -Iseconds) ===" cd /root/esameits24-26backend git pull --ff-only echo "=== DOCKER BUILD $(date -Iseconds) ===" docker compose --progress plain up -d --build echo "=== END $(date -Iseconds) ===" docker compose ps echo "DEPLOY COMPLETE"