-
Notifications
You must be signed in to change notification settings - Fork 4
80 lines (68 loc) · 2.28 KB
/
docs.yaml
File metadata and controls
80 lines (68 loc) · 2.28 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Build & Deploy Sphinx docs
on:
push:
branches: [ main ] # change if your default branch is different
pull_request:
branches: [ main ] # build on PRs (no deploy)
workflow_dispatch: # manual run
# Avoid overlapping deployments
concurrency:
group: "pages"
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11" # pick the version you prefer
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install docs dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/requirements.txt
# If your docs use autodoc (import your package), install it too:
- name: Install package (editable)
run: pip install -e .
# Optional: set html_baseurl at build time (nice for canonical links)
# Replace URL if you want to hardcode; otherwise you can delete -D line.
- name: Build Sphinx HTML
run: |
sphinx-build \
-b html \
-D html_baseurl="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/" \
docs docs/_build/html
# Optional: include CNAME if you use a custom domain. Create docs/CNAME.
- name: Add CNAME (if present)
run: |
if [ -f docs/CNAME ]; then
cp docs/CNAME docs/_build/html/CNAME
fi
- name: Upload artifact (site)
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html
# Deploy only on pushes (not PRs)
deploy:
if: ${{ github.event_name == 'push' }}
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v4