-
Notifications
You must be signed in to change notification settings - Fork 1
52 lines (43 loc) · 1.33 KB
/
mkdocs.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
name: MkDocs Build and Deploy
on:
push:
branches:
- main # 触发构建的分支
jobs:
MkDocs-Build-and-Deploy:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x # 选择合适的 Python 版本
- name: Install dependencies
run: |
pip install -r requirements.txt
mkdocs --version
# 如果你的项目依赖其他 Python 包,可以在这里安装它们
- name: Build MkDocs site
run: |
mkdocs build --clean
mkdocs --version
# 如果你的 MkDocs 配置文件不在根目录,使用 -f 选项指定文件路径,例如:mkdocs build -f path/to/mkdocs.yml
- name: Upload to GitHub Pages
uses: actions/upload-pages-artifact@v2
with:
path: site
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
path: site
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
- name: Save build cache
uses: actions/cache/save@v3
with:
key: mkdocs-material-${{ hashfiles('.cache/**') }}
path: .cache