-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (50 loc) · 1.51 KB
/
deploy-docs.yml
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
# 部署 docs pages 到 GitHub 页面
name: deploy-docs
on:
# 通过推送或拉取主分支(main)事件触发工作流
push:
branches:
- main
# 这将启用“操作”选项卡上的“运行工作流”按钮
workflow_dispatch:
# 设置 GITHUB_TOKEN 的权限,允许部署到 GitHub 页面
permissions:
contents: read
pages: write
id-token: write
# 只允许一个并发部署,跳过正在运行和最新队列之间的运行队列,
# 但是, 不要取消正在进行的 action, 因为我们希望允许这些生产部署完成
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# 部署作业,因为我们只是在部署
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# 指定了操作系统为‘ubuntu-latest’
runs-on: ubuntu-latest
# Steps 代表一系列任务作为作业的一部分而被执行
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: npm
- name: Install dependencies
run: npm install
- name: Build Docs
run: npm run docs
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# 上传 page 的路径
path: './docs/src'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4