-
Notifications
You must be signed in to change notification settings - Fork 3
46 lines (39 loc) · 1.7 KB
/
build_documentation.yaml
File metadata and controls
46 lines (39 loc) · 1.7 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
# GitHub Actions workflow to build and deploy Sphinx documentation to GitHub Pages
name: Docs
# Trigger the workflow on pushes, pull requests, or manual dispatch events
on:
push: # 1. Rebuild docs on every push to any branch
pull_request: # 2. Also run on every pull request
workflow_dispatch: # 3. Allow manual triggers from the GitHub UI
permissions:
contents: write # Required so the deploy step can push to gh-pages
jobs:
docs:
runs-on: ubuntu-latest # Use the latest Ubuntu runner provided by GitHub
steps:
# 1. Check out the repository contents
- name: Checkout repository
uses: actions/checkout@v3
# 2. Set up a Python environment (defaults to latest 3.x)
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
# 3. Install Sphinx and its themes/extensions
- name: Install dependencies
run: |
pip install sphinx sphinx_rtd_theme sphinx-copybutton
pip install -e .
# 4. Build the HTML documentation
- name: Build Sphinx docs
run: |
sphinx-build doc _build
# 5. Deploy the docs to the gh-pages branch (only on push to master)
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
with:
publish_branch: gh-pages # Target branch for the published site
github_token: ${{ secrets.GITHUB_TOKEN }} # Auth token provided by GitHub
publish_dir: _build/ # Directory containing the built HTML
force_orphan: true # Create branch history from scratch each deployment