11name : Deploy Documentation
22
33on :
4- # This will run after merging a pull request onto main
54 push :
65 branches :
76 - main
7+ # Optional: manual trigger
8+ workflow_dispatch :
89
910jobs :
1011 deploy-docs :
@@ -13,46 +14,43 @@ jobs:
1314 contents : write
1415
1516 steps :
16- - name : Run a one-line script
17- run : echo "The job was automatically triggered by a ${{ github.event_name }} event."
18-
19- - name : checkout
20- uses : actions/checkout@v4
21- with :
22- fetch-depth : 0
23-
24- # Using channel conda-forge helps deal with pandoc installation issues
25- - name : Setup Micromamba ${{ matrix.python-version }}
26- uses : mamba-org/setup-micromamba@v2.0.1
27- with :
28- environment-name : TEST
29- init-shell : bash
30- create-args : >-
31- python=3 pip
32- --file requirements-dev.txt
33- --channel conda-forge
34-
35- - name : Install oceanarray
36- shell : bash -l {0}
37- run : |
38- python -m pip install -e . --no-deps --force-reinstall
39-
40- # Assumes that the notebook to be documented is located within notebooks/ and is called demo.ipynb
41- # In the example below, we've included the `--ExecutePreprocessor.allow_errors=True` flag to allow the notebook to build even if there are errors
42- # For production runs (and when your code is cleaner), you can remove this flag or set it to False.
43- - name : Build documentation
44- shell : bash -l {0}
45- run : |
46- set -e
47- jupyter nbconvert --to notebook --execute notebooks/demo_instrument.ipynb --output=demo_instrument-output.ipynb --ExecutePreprocessor.allow_errors=True
48- jupyter nbconvert --to notebook --execute notebooks/demo_mooring.ipynb --output=demo_mooring-output.ipynb --ExecutePreprocessor.allow_errors=True
49- mv notebooks/*output.ipynb docs/source/
50- pushd docs
51- make clean html
52- popd
53-
54- - name : Deploy
55- uses : peaceiris/actions-gh-pages@v4
56- with :
57- github_token : ${{ secrets.GITHUB_TOKEN }}
58- publish_dir : docs/build/html
17+ - name : Checkout
18+ uses : actions/checkout@v4
19+ with :
20+ fetch-depth : 0
21+
22+ - name : Setup Micromamba
23+ uses : mamba-org/setup-micromamba@v2
24+ with :
25+ environment-file : environment.yml
26+ init-shell : bash
27+ condarc : |
28+ channels:
29+ - conda-forge
30+ channel_priority: strict
31+ cache-environment : true
32+
33+ - name : Install package (editable)
34+ shell : bash -l {0}
35+ run : |
36+ micromamba run -n TEST python -m pip install --upgrade pip
37+ micromamba run -n TEST python -m pip install -e . --no-deps --force-reinstall
38+
39+ - name : Build documentation
40+ shell : bash -l {0}
41+ run : |
42+ set -e
43+ micromamba run -n TEST jupyter nbconvert --to notebook --execute notebooks/demo_instrument.ipynb --output=demo_instrument-output.ipynb --ExecutePreprocessor.allow_errors=True
44+ micromamba run -n TEST jupyter nbconvert --to notebook --execute notebooks/demo_mooring.ipynb --output=demo_mooring-output.ipynb --ExecutePreprocessor.allow_errors=True
45+ mv notebooks/*output.ipynb docs/source/
46+ pushd docs
47+ micromamba run -n TEST make clean html
48+ popd
49+
50+ - name : Deploy to GitHub Pages
51+ uses : peaceiris/actions-gh-pages@v4
52+ with :
53+ github_token : ${{ secrets.GITHUB_TOKEN }}
54+ publish_dir : docs/build/html
55+ # Optional: publish_branch: gh-pages
56+ # Optional: cname: docs.example.org
0 commit comments