Repository navigation
59 lines (48 loc) · 2.18 KB
/
Copy pathmake_docs.yml
File metadata and controls
59 lines (48 loc) · 2.18 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
# This is a basic workflow to help you get started with Actions
name: Make docs
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: 初始化Git
run: |
git config --global user.name ${{ secrets.GTNAME }}
git config --global user.email ${{ secrets.EMAIL }}
git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- name: 安装Python依赖包
run: pip install sphinx sphinx-autobuild sphinx_rtd_theme
# 如果docs目录名有变此处需要修改
# 未来加入 find ./api_doc -name “*.rst” | xargs rm -f
- name: 清除旧代码文档
run: |
find $GITHUB_WORKSPACE/AgentMaker-Doc/docs/api_docs -name “*.rst” | xargs rm -f
- name: 生成文档
# 生成./..目录下的所有py相关的文件注释,并放在api_docs中,如果docs目录名有变此处需要修改
run: |
cd $GITHUB_WORKSPACE/AgentMaker-Doc/docs
sphinx-apidoc -o $GITHUB_WORKSPACE/AgentMaker-Doc/docs/api_docs $GITHUB_WORKSPACE/AgentMaker-Doc
sphinx-build -b html $GITHUB_WORKSPACE/AgentMaker-Doc/docs $GITHUB_WORKSPACE/AgentMaker-Doc/docs/output
# make html
- name: 将代码放入工作区并进行提交
# 需要在设置中添加secrets.EMAIL、secrets.GITHUB_TOKEN,分支有变化则需要修改git push origin mian的main
run: |
cd $GITHUB_WORKSPACE/AgentMaker-Doc
git add -A $GITHUB_WORKSPACE/AgentMaker-Doc/docs
git commit -m "Updated docs"
- name: 开始提交
run: |
cd $GITHUB_WORKSPACE/AgentMaker-Doc
git push origin main