Skip to content

Commit 8582f4e

Browse files
committed
feat: add GitHub Actions workflow for building and deploying documentation
1 parent 8a74535 commit 8582f4e

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

.github/workflows/docs.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Docs
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
pages: write
13+
id-token: write
14+
actions: read
15+
16+
concurrency:
17+
group: docs-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build-docs:
22+
runs-on: ubuntu-latest
23+
defaults:
24+
run:
25+
shell: bash
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Set up Miniconda
33+
uses: conda-incubator/setup-miniconda@v3
34+
with:
35+
activate-environment: docs
36+
auto-update-conda: true
37+
python-version: 3.11
38+
channels: conda-forge,defaults
39+
40+
- name: Install docs dependencies
41+
run: |
42+
conda install -y sphinx nbsphinx ipykernel jupyter nbconvert pandoc sphinx-rtd-theme \
43+
click networkx h5py pandas numba diskcache tabulate
44+
pip install -e .
45+
python -m pip list
46+
47+
- name: Build HTML docs
48+
working-directory: docsrc
49+
env:
50+
NBSPHINX_ALLOW_ERRORS: "0"
51+
run: |
52+
sphinx-build -b html -W --keep-going . _build/html
53+
echo "Built docs size:" && du -sh _build/html || true
54+
55+
- name: Upload docs artifact
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: docs-html
59+
path: docsrc/_build/html
60+
if-no-files-found: error
61+
retention-days: 7
62+
63+
deploy:
64+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
65+
needs: build-docs
66+
runs-on: ubuntu-latest
67+
permissions:
68+
contents: read
69+
pages: write
70+
id-token: write
71+
environment:
72+
name: github-pages
73+
url: ${{ steps.deployment.outputs.page_url }}
74+
steps:
75+
- name: Download built docs
76+
uses: actions/download-artifact@v4
77+
with:
78+
name: docs-html
79+
path: ./site
80+
81+
- name: Configure Pages
82+
uses: actions/configure-pages@v5
83+
84+
- name: Upload Pages artifact
85+
uses: actions/upload-pages-artifact@v3
86+
with:
87+
path: ./site
88+
89+
- name: Deploy to GitHub Pages
90+
id: deployment
91+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)