From 1a4b6b0dbad395e24a986bb22785f80094bf1ed9 Mon Sep 17 00:00:00 2001 From: anghunk Date: Wed, 21 Jan 2026 14:36:53 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=92=8C=E9=83=A8=E7=BD=B2=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加 GitHub Actions 工作流用于自动构建和部署 VitePress 文档 同时更新文档配置添加 base 路径 --- .github/workflows/docs.yml | 55 ++++++++++++++++++++++++++++++++++++++ docs/.vitepress/config.mjs | 1 + 2 files changed, 56 insertions(+) create mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..60bd491 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,55 @@ +name: Build and Deploy Docs + +on: + push: + branches: + - main + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + cache-dependency-path: docs/package-lock.json + + - name: Install dependencies + working-directory: docs + run: npm install + + - name: Build VitePress site + working-directory: docs + run: npm run build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: docs/.vitepress/dist + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 + diff --git a/docs/.vitepress/config.mjs b/docs/.vitepress/config.mjs index d121921..9682414 100644 --- a/docs/.vitepress/config.mjs +++ b/docs/.vitepress/config.mjs @@ -6,6 +6,7 @@ export default defineConfig({ title: 'CWD 评论系统文档', description: '基于 Cloudflare Workers 的轻量级评论系统', lang: 'zh-CN', + base: '/cwd/', head: [ [ 'link',