-
Notifications
You must be signed in to change notification settings - Fork 9
46 lines (38 loc) · 1.44 KB
/
doc.yml
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
name: Build-sphinx-doc
on:
push:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[doc]
pip install ghp-import
- name: Build HTML
env:
TOKEN: ${{ secrets.TOKEN }}
run: |
# Convert the dummy token to the real token for executing the jupyter notebook
sed -i "s/YOUR_TOKEN/$TOKEN/" doc/source/Tutorial/onc_Library_Tutorial.ipynb
sed -i '/nb_execution_mode = "off"/d' doc/source/conf.py # enable executing jupyter notebook
sphinx-build -W doc/source doc/build/html
- name: Remove ampersand encoding and token in the generated html
env:
TOKEN: ${{ secrets.TOKEN }}
run: |
# See issues about ampersand encoding at https://github.com/executablebooks/MyST-Parser/issues/760
sed -i 's/amp;//g' doc/build/html/Tutorial/Oceans_3.0_API_Tutorial.html
# Some cell outputs in the Jupyter notebook contain the token
sed -i "s/$TOKEN/YOUR_TOKEN/g" doc/build/html/Tutorial/onc_Library_Tutorial.html
- name: Run ghp-import to generate GitHub Pages
run: |
ghp-import -npfo doc/build/html