Skip to content

Commit 271c82c

Browse files
authored
Create add_pages_doc.yml
1 parent 75e3b06 commit 271c82c

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/add_pages_doc.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build and Deploy Github Pages
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the "main" branch
8+
push:
9+
branches: [ "main" ]
10+
pull_request:
11+
branches: [ "main" ]
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
19+
jobs:
20+
# This workflow contains a single job called "build"
21+
build_and_deploy:
22+
# The type of runner that the job will run on
23+
runs-on: ubuntu-latest
24+
25+
# Steps represent a sequence of tasks that will be executed as part of the job
26+
steps:
27+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
# Runs a single command using the runners shell
32+
- name: Set up Python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: '3.11' # 使用 .readthedocs.yaml 中指定的 Python 版本
36+
37+
- name: Build Sphinx Documentation
38+
run: make html
39+
working-directory: docs # 确保在 docs/ 目录中执行 make 命令
40+
41+
- name: Prepare Pages Artifact
42+
# 将构建好的 HTML 目录移动到一个标准名称,方便 upload-pages-artifact 使用
43+
run: |
44+
mv docs/_build/html _site
45+
46+
- name: Upload Pages Artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: _site # 上一步准备好的 Artifact 目录
50+
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4
54+

0 commit comments

Comments
 (0)