All checks were successful
CI/CD — Build & Deploy / Build & Deploy (push) Successful in 29s
Backend: 5 modules (auth, user, work, list, health), AniList GraphQL proxy, SuperOAuth PKCE introspection, XP system, migrations TypeORM. Frontend: SvelteKit adapter-node, PWA manifest, dark theme, pages home/search/list/profile/callback. Infra: CI/CD Gitea vps-runner, Apache vhost SSL, pm2 sakuin-backend + sakuin-frontend, port 4002. License: BSL 1.1 (Apache 2.0 en 2028).
61 lines
2.3 KiB
YAML
61 lines
2.3 KiB
YAML
name: CI/CD — Build & Deploy
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
name: Build & Deploy
|
|
runs-on: vps-runner
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# ── Backend ──────────────────────────────────────────────────────────────
|
|
- name: Install & build backend
|
|
working-directory: backend
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Deploy backend
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
run: |
|
|
mkdir -p /var/www/sakuin/backend
|
|
rsync -a --delete backend/dist/ /var/www/sakuin/backend/dist/
|
|
rsync -a backend/package.json backend/package-lock.json /var/www/sakuin/backend/
|
|
cd /var/www/sakuin/backend && npm ci --omit=dev
|
|
|
|
- name: Restart pm2
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
run: |
|
|
su - tetardtek-brain -c 'pm2 reload sakuin-backend --update-env'
|
|
|
|
# ── Frontend ─────────────────────────────────────────────────────────────
|
|
- name: Install & build frontend
|
|
working-directory: frontend
|
|
env:
|
|
VITE_API_URL: https://sakuin.tetardtek.com/api
|
|
VITE_OAUTH_URL: https://superoauth.tetardtek.com
|
|
VITE_OAUTH_CLIENT_ID: sakuin
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Deploy frontend
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
run: |
|
|
mkdir -p /var/www/sakuin/frontend/build
|
|
rsync -a --delete frontend/build/ /var/www/sakuin/frontend/build/
|
|
|
|
# ── Smoke test ───────────────────────────────────────────────────────────
|
|
- name: Smoke test API
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
|
run: |
|
|
sleep 3
|
|
curl -sf http://localhost:4002/api/health | grep -q '"ok"'
|
|
echo "✅ API health OK"
|