From dd4882682bc2add47bfb6cae5f883af21e069d27 Mon Sep 17 00:00:00 2001 From: The Mark Date: Sun, 7 Jun 2026 15:53:03 +0800 Subject: [PATCH] ci(docs): deploy VitePress to GitHub Pages on push to main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - new: .github/workflows/docs.yml — build on PRs touching apps/docs (or CI/lockfile inputs), deploy on main pushes only. Uses the standard configure-pages → upload-pages-artifact → deploy-pages chain. - shared.ts: thread `base` through DOCS_BASE env var so production builds get '/Bridgent/' (the project page URL) while local dev/preview keep '/'. CI workflow sets the env explicitly. - apps/docs/public/.nojekyll: empty file so GitHub Pages serves VitePress's `_assets/` etc verbatim instead of running Jekyll. One-time repo setup the maintainer still has to do: Settings → Pages → Source = "GitHub Actions" If a custom domain (e.g. bridgent.ai) gets pointed at the page later, flip DOCS_BASE to '/' in the workflow and add CNAME in apps/docs/public. --- .github/workflows/docs.yml | 88 ++++++++++++++++++++++++++ apps/docs/.vitepress/locales/shared.ts | 7 ++ apps/docs/public/.nojekyll | 0 3 files changed, 95 insertions(+) create mode 100644 .github/workflows/docs.yml create mode 100644 apps/docs/public/.nojekyll diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..819379b --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,88 @@ +name: Docs + +on: + push: + branches: [main] + paths: + - 'apps/docs/**' + - 'pnpm-lock.yaml' + - 'pnpm-workspace.yaml' + - 'package.json' + - '.github/workflows/docs.yml' + pull_request: + paths: + - 'apps/docs/**' + - 'pnpm-lock.yaml' + - 'pnpm-workspace.yaml' + - 'package.json' + - '.github/workflows/docs.yml' + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +# Pages deployment is single-flight; let an in-progress deploy finish. +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + name: Build (VitePress) + runs-on: ubuntu-latest + env: + NPM_CONFIG_REGISTRY: https://registry.npmjs.org/ + # GitHub Pages project site: https://.github.io// + # Override to '/' when serving from a custom domain. + DOCS_BASE: /Bridgent/ + + steps: + - uses: actions/checkout@v6 + + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: '24' + + - name: Activate pnpm via Corepack + run: | + npm install -g corepack@latest + corepack enable + corepack prepare --activate + + - name: Cache pnpm store + uses: actions/cache@v5 + with: + path: ~/.local/share/pnpm/store + key: pnpm-store-${{ runner.os }}-docs-${{ hashFiles('pnpm-lock.yaml') }} + restore-keys: | + pnpm-store-${{ runner.os }}-docs- + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build VitePress + run: pnpm --filter @bridgent/docs build + + - name: Configure Pages + uses: actions/configure-pages@v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: apps/docs/.vitepress/dist + + deploy: + name: Deploy to GitHub Pages + if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy + id: deployment + uses: actions/deploy-pages@v4 diff --git a/apps/docs/.vitepress/locales/shared.ts b/apps/docs/.vitepress/locales/shared.ts index 7fb7855..3bdd903 100644 --- a/apps/docs/.vitepress/locales/shared.ts +++ b/apps/docs/.vitepress/locales/shared.ts @@ -1,9 +1,16 @@ // apps/docs/.vitepress/locales/shared.ts import type { DefaultTheme, UserConfig } from 'vitepress' +import process from 'node:process' + +// GitHub Pages project sites live at //, so the build needs a non-root +// `base`. The CI workflow exports DOCS_BASE; for custom domains set DOCS_BASE=/ +// (or leave it unset locally to keep dev/preview using `/`). +const base = process.env.DOCS_BASE ?? '/' export const shared = { title: 'Bridgent AI', titleTemplate: ':title — Bridgent AI', + base, cleanUrls: true, lastUpdated: true, themeConfig: { diff --git a/apps/docs/public/.nojekyll b/apps/docs/public/.nojekyll new file mode 100644 index 0000000..e69de29