name: Deploy on: workflow_run: workflows: ["CI"] types: [completed] branches: [main] concurrency: group: deploy-${{ github.ref }} cancel-in-progress: true jobs: deploy: name: deploy to VPS if: ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v5 - name: Download build artifact uses: actions/download-artifact@v4 with: name: mcpedia-web-standalone path: standalone - name: Copy pre-built .next to VPS uses: appleboy/scp-action@v1 with: host: ${{ secrets.SSH_DEPLOY_HOST }} port: ${{ secrets.SSH_DEPLOY_PORT }} username: ${{ secrets.SSH_DEPLOY_USER }} key: ${{ secrets.SSH_DEPLOY_KEY }} source: "standalone/***" target: "/home/code/mcpedia/apps/web/.next" - name: Deploy to VPS over SSH uses: appleboy/ssh-action@v1 with: host: ${{ secrets.SSH_DEPLOY_HOST }} port: ${{ secrets.SSH_DEPLOY_PORT }} username: ${{ secrets.SSH_DEPLOY_USER }} key: ${{ secrets.SSH_DEPLOY_KEY }} envs: SSH_DEPLOY_HOST script: | set -e cd /home/code/mcpedia # Pull latest code (for content, .env, and non-web changes) git pull origin main /home/code/.bun/bin/bun install --frozen-lockfile /home/code/.bun/bin/bun run scripts/indexer.ts # The .next/ was just copied from CI (pre-built, no build on VPS) # Restart services to pick up the new build sudo systemctl restart mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker sleep 3 systemctl --no-pager status mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker --no-legend