- ci.yml: add web build step + upload .next as artifact - deploy.yml: download artifact via SCP, copy to VPS .next dir (no bun run build on VPS — only git pull + install + index + restart) - Bump actions/checkout@v4 → @v5 (Node 20 deprecation) - Revert next.config standalone mode (not needed for .next/ copy approach) - Remove broken bun --cwd (doesn't support --cwd flag)
60 lines
1.8 KiB
YAML
60 lines
1.8 KiB
YAML
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
|