44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
name: 构建和部署文档
|
|
# Build and Deploy Documentation
|
|
|
|
on:
|
|
push:
|
|
branches: [ main, master ]
|
|
pull_request:
|
|
branches: [ main, master ]
|
|
|
|
jobs:
|
|
build-docs:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: 检出代码
|
|
uses: actions/checkout@v4
|
|
|
|
- name: 设置Python环境
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: 安装依赖
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install -r documentation/sphinx-docs/requirements.txt
|
|
|
|
- name: 构建Sphinx文档
|
|
run: |
|
|
cd documentation/sphinx-docs
|
|
make html
|
|
|
|
- name: 部署到GitHub Pages
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./documentation/sphinx-docs/_build/html
|
|
|
|
- name: 上传构建产物
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: documentation
|
|
path: documentation/sphinx-docs/_build/html/ |