ci: 添加文档构建和部署工作流

添加 GitHub Actions 工作流用于自动构建和部署 VitePress 文档
同时更新文档配置添加 base 路径
This commit is contained in:
anghunk
2026-01-21 14:36:53 +08:00
parent 903bdef5ac
commit 1a4b6b0dba
2 changed files with 56 additions and 0 deletions

55
.github/workflows/docs.yml vendored Normal file
View File

@@ -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

View File

@@ -6,6 +6,7 @@ export default defineConfig({
title: 'CWD 评论系统文档',
description: '基于 Cloudflare Workers 的轻量级评论系统',
lang: 'zh-CN',
base: '/cwd/',
head: [
[
'link',