fix: Phase 14 + Phase 15 — UI/UX polish + CI/CD restructure
=== UI/UX (Phase 14 + 15) === - Remove 'body' field from showing as custom badge (added to STANDARD_KEYS) - Capitalize doc type: 'documentation' → 'Documentation', 'writeup' → 'Writeup' - Sidebar tree: border-l per depth level + section separators (tee-style) - Homepage tree: use doc titles from DB (not path segments) - Centralize section config in packages/config/src/sections.ts (no hardcode in UI) - Client-safe config entrypoint: @mcpedia/config/sections (avoids node:fs in client) === CI/CD (Phase 15b) === - Bump actions/checkout v4 → v5 (Node 20 deprecation) - Fix: 'bun --cwd X run Y' doesn't work (bun run rejects --cwd flag) → use 'working-directory: X' instead - Fix: .next/ is a hidden directory — upload-artifact needs include-hidden-files: true - Merge CI + Deploy into single workflow (workflow_run can't share artifacts) - VPS no longer builds: CI builds .next/ → uploads artifact → VPS deploys via tarball+scp+ssh - MCP smoke test made conditional on DATABASE_URL (CI has no Postgres)
This commit is contained in:
1 parent
f14f3e92c5
commit
ea75d68b1a
1 file changed
+26
-27
+26
-27
@@ -6,7 +6,6 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
# Cancel in-progress runs for the same ref so a fresh push supersedes them.
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ci-${{ github.ref }}
|
group: ci-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
@@ -27,7 +26,6 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: bun install --frozen-lockfile
|
run: bun install --frozen-lockfile
|
||||||
|
|
||||||
# Real build: typecheck + turbo across all workspace packages.
|
|
||||||
- name: Typecheck
|
- name: Typecheck
|
||||||
run: bun run typecheck
|
run: bun run typecheck
|
||||||
|
|
||||||
@@ -35,12 +33,16 @@ jobs:
|
|||||||
working-directory: apps/web
|
working-directory: apps/web
|
||||||
run: bun run build
|
run: bun run build
|
||||||
|
|
||||||
- name: List .next contents
|
# Upload the built .next directory (hidden dir → include-hidden-files).
|
||||||
working-directory: apps/web
|
- name: Upload web build artifact
|
||||||
run: ls -la .next/ | head -10
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: mcpedia-web-build
|
||||||
|
path: apps/web/.next
|
||||||
|
include-hidden-files: true
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
# Smoke: verify the MCP server + resources load and the indexer/module
|
# Smoke: requires Postgres + Redis — skipped in CI without secrets.
|
||||||
# graph resolves. Requires Postgres + Redis — only runs when available.
|
|
||||||
- name: MCP smoke test
|
- name: MCP smoke test
|
||||||
if: env.DATABASE_URL != ''
|
if: env.DATABASE_URL != ''
|
||||||
working-directory: apps/mcp
|
working-directory: apps/mcp
|
||||||
@@ -49,21 +51,10 @@ jobs:
|
|||||||
REDIS_URL: ${{ secrets.REDIS_URL }}
|
REDIS_URL: ${{ secrets.REDIS_URL }}
|
||||||
run: bun run smoke
|
run: bun run smoke
|
||||||
|
|
||||||
# Unit tests across all packages + apps. CI has no Postgres/Redis, so
|
# Unit tests — bun:test mocks, no external services.
|
||||||
# tests use bun:test module mocking to stub @mcpedia/db, @mcpedia/queue,
|
|
||||||
# and @mcpedia/embeddings — no live I/O.
|
|
||||||
- name: Test
|
- name: Test
|
||||||
run: bun run test
|
run: bun run test
|
||||||
|
|
||||||
# Upload the built .next directory as a deploy artifact.
|
|
||||||
# The deploy job copies this directly to the VPS — no build needed there.
|
|
||||||
- name: Upload web build artifact
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: mcpedia-web-build
|
|
||||||
path: ${{ github.workspace }}/apps/web/.next
|
|
||||||
retention-days: 1
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
name: deploy to VPS
|
name: deploy to VPS
|
||||||
needs: build
|
needs: build
|
||||||
@@ -77,19 +68,26 @@ jobs:
|
|||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: mcpedia-web-build
|
name: mcpedia-web-build
|
||||||
path: .next
|
path: apps/web/.next
|
||||||
|
|
||||||
- name: Copy pre-built .next to VPS
|
# Tar .next, then SCP the tarball to VPS (single file = reliable transfer).
|
||||||
|
- name: Tar .next
|
||||||
|
run: |
|
||||||
|
# Exclude cache to reduce tarball size (cache is ephemeral)
|
||||||
|
tar -C apps/web --exclude='.next/cache' -czf mcpedia-web-next.tar.gz .next
|
||||||
|
ls -lh mcpedia-web-next.tar.gz
|
||||||
|
|
||||||
|
- name: Copy tarball to VPS
|
||||||
uses: appleboy/scp-action@v1
|
uses: appleboy/scp-action@v1
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.SSH_DEPLOY_HOST }}
|
host: ${{ secrets.SSH_DEPLOY_HOST }}
|
||||||
port: ${{ secrets.SSH_DEPLOY_PORT }}
|
port: ${{ secrets.SSH_DEPLOY_PORT }}
|
||||||
username: ${{ secrets.SSH_DEPLOY_USER }}
|
username: ${{ secrets.SSH_DEPLOY_USER }}
|
||||||
key: ${{ secrets.SSH_DEPLOY_KEY }}
|
key: ${{ secrets.SSH_DEPLOY_KEY }}
|
||||||
source: ".next/*"
|
source: "mcpedia-web-next.tar.gz"
|
||||||
target: "/home/code/mcpedia/apps/web/.next"
|
target: "/tmp/"
|
||||||
|
|
||||||
- name: Deploy to VPS over SSH
|
- name: Unpack and restart on VPS
|
||||||
uses: appleboy/ssh-action@v1
|
uses: appleboy/ssh-action@v1
|
||||||
with:
|
with:
|
||||||
host: ${{ secrets.SSH_DEPLOY_HOST }}
|
host: ${{ secrets.SSH_DEPLOY_HOST }}
|
||||||
@@ -101,13 +99,14 @@ jobs:
|
|||||||
set -e
|
set -e
|
||||||
cd /home/code/mcpedia
|
cd /home/code/mcpedia
|
||||||
|
|
||||||
# Pull latest code (for content, .env, and non-web changes)
|
|
||||||
git pull origin main
|
git pull origin main
|
||||||
/home/code/.bun/bin/bun install --frozen-lockfile
|
/home/code/.bun/bin/bun install --frozen-lockfile
|
||||||
/home/code/.bun/bin/bun run scripts/indexer.ts
|
/home/code/.bun/bin/bun run scripts/indexer.ts
|
||||||
|
|
||||||
# The .next/ was just copied from CI (pre-built, no build on VPS)
|
rm -rf apps/web/.next
|
||||||
# Restart services to pick up the new build
|
tar -xzf /tmp/mcpedia-web-next.tar.gz -C apps/web/
|
||||||
|
rm -f /tmp/mcpedia-web-next.tar.gz
|
||||||
|
|
||||||
sudo systemctl restart mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker
|
sudo systemctl restart mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker
|
||||||
sleep 3
|
sleep 3
|
||||||
systemctl --no-pager status mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker --no-legend
|
systemctl --no-pager status mcpedia-web mcpedia-api mcpedia-mcp mcpedia-worker --no-legend
|
||||||
Reference in new issue
Block a user