Merge pull request #37 from OceanNetworksCanada/quickfix-doc #18
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
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 |