-
Notifications
You must be signed in to change notification settings - Fork 58
60 lines (49 loc) · 1.5 KB
/
Copy pathdeploy-docs.yml
File metadata and controls
60 lines (49 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# 名称
name: 部署文档
# 触发条件:main 分支上 docs 目录有变更时,或手动触发
on:
push:
branches: [main]
paths:
- "docs/**"
- ".github/workflows/deploy-docs.yml"
workflow_dispatch:
# 同一分支上新推送取消尚未完成的旧运行
concurrency:
group: deploy-docs-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
# 任务
jobs:
deploy-gh-pages:
# 服务器环境:最新版 Ubuntu
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs/
steps:
- name: 拉取代码
uses: actions/checkout@v7
with:
fetch-depth: 0
- name: 安装 Node.js
uses: actions/setup-node@v7
with:
node-version: 24
- name: 安装 pnpm
run: npm install -g pnpm@11
- name: 安装依赖
run: pnpm install
- name: 构建文档
run: pnpm run build
# 产物里有供「取本页 Markdown」直读的原始 .md,其中代码生成模板等处的双花括号不是 Liquid 模板。
# 缺少该标记时 GitHub Pages 会交给 Jekyll 处理:.md 被转成 HTML,双花括号还可能让构建失败。
- name: 验证 GitHub Pages 静态托管标记
run: test -f .vitepress/dist/.nojekyll
- name: 部署文档
uses: JamesIves/github-pages-deploy-action@v4
with:
# 这是文档部署到的分支名称
branch: gh-pages
folder: ./docs/.vitepress/dist