fix: CI/CD — move web build to CI, VPS only deploys (no build on VPS)

- 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)
This commit is contained in:
asepharyana
2026-08-21 11:43:21 +07:00
parent a9b67385c3
commit 77792c624b
3 changed files with 65 additions and 25 deletions
+19 -13
View File
@@ -12,26 +12,28 @@ concurrency:
jobs:
deploy:
name: build + deploy
name: deploy to VPS
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Bun
uses: oven-sh/setup-bun@v2
- name: Download build artifact
uses: actions/download-artifact@v4
with:
bun-version: "1.3.14"
name: mcpedia-web-standalone
path: standalone
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Typecheck
run: bun run typecheck
- name: Build web app
run: bun run build --filter=@mcpedia/web
- 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
@@ -44,10 +46,14 @@ jobs:
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
cd apps/web && /home/code/.bun/bin/bun run build && cd /home/code/mcpedia
/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