22name : Documentation
33
44on :
5- # Runs on pushes targeting the default branch
65 push :
76 branches : ["master"]
8-
7+ workflow_call :
98 # Allows you to run this workflow manually from the Actions tab
109 workflow_dispatch :
1110
12- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13- permissions :
14- contents : write
15- pages : write
16- id-token : write
11+ # Set permissions at the job level.
12+ permissions : {}
1713
1814# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
1915# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
@@ -22,33 +18,41 @@ concurrency:
2218 cancel-in-progress : false
2319
2420jobs :
25- # Single deploy job since we're just deploying
26- deploy :
27- environment :
28- name : github-pages
29- url : ${{ steps.deployment.outputs.page_url }}
30- runs-on : ubuntu-latest
21+ build :
22+ runs-on : ubuntu-slim
3123 steps :
3224 - uses : actions/checkout@v6
3325 - uses : actions/setup-python@v6
3426 with :
3527 python-version : " 3.14"
28+ cache : ' pip'
29+
3630 - run : |
37- python -m python -m pip install --upgrade pip
31+ python -m pip install --upgrade pip
3832 python -m pip install . --group=docs
39- - name : Sphinx APIDoc
40- run : |
41- sphinx-apidoc --force -o docs/source/ .
42- - name : Sphinx build
43- run : |
33+ python -m pip list
34+
35+ - run : |
4436 sphinx-build --builder html docs/source/ docs/build/html
45- - name : Setup Pages
46- uses : actions/configure-pages@v5
47- - name : Upload artifact
37+
38+ - name : Upload artifact (only on push to master)
39+ if : github.event_name == 'push' && github.ref == 'refs/heads/master'
4840 uses : actions/upload-pages-artifact@v4
4941 with :
50- # Upload entire repository
5142 path : ' ./docs/build/html'
43+
44+ deploy :
45+ needs : build
46+ # Deploy only on push to master
47+ if : github.event_name == 'push' && github.ref == 'refs/heads/master'
48+ permissions :
49+ pages : write
50+ id-token : write
51+ environment :
52+ name : github-pages
53+ url : ${{ steps.deployment.outputs.page_url }}
54+ runs-on : ubuntu-slim
55+ steps :
5256 - name : Deploy to GitHub Pages
5357 id : deployment
5458 uses : actions/deploy-pages@v4
0 commit comments