ci: 添加文档构建和部署工作流
添加 GitHub Actions 工作流用于自动构建和部署 VitePress 文档 同时更新文档配置添加 base 路径
This commit is contained in:
55
.github/workflows/docs.yml
vendored
Normal file
55
.github/workflows/docs.yml
vendored
Normal 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
|
||||||
|
|
||||||
@@ -6,6 +6,7 @@ export default defineConfig({
|
|||||||
title: 'CWD 评论系统文档',
|
title: 'CWD 评论系统文档',
|
||||||
description: '基于 Cloudflare Workers 的轻量级评论系统',
|
description: '基于 Cloudflare Workers 的轻量级评论系统',
|
||||||
lang: 'zh-CN',
|
lang: 'zh-CN',
|
||||||
|
base: '/cwd/',
|
||||||
head: [
|
head: [
|
||||||
[
|
[
|
||||||
'link',
|
'link',
|
||||||
|
|||||||
Reference in New Issue
Block a user