ADMT Tasks (see miletones) #246
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 documentation | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
sudo apt-get install pandoc | |
python -m pip install --upgrade pip | |
pip install gsw numpy netCDF4 matplotlib Sphinx jupyter myst-parser sphinx-rtd-theme | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Build documentation | |
run: | | |
python -m jupyter nbconvert README.ipynb --execute --to rst --output README.rst --output-dir docs | |
sphinx-build docs docs/_build/html | |
- name: Clone gh-pages branch | |
if: success() && (github.ref == 'refs/heads/master') | |
uses: actions/checkout@master | |
with: | |
ref: gh-pages | |
path: pages-clone | |
- name: Update documentation | |
if: success() && (github.ref == 'refs/heads/master') | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
cd pages-clone | |
git rm -rf . | |
cp -R ../docs/_build/html/* . | |
touch .nojekyll | |
git add .nojekyll | |
git add * | |
git commit --allow-empty -m"update documentation" | |
git push |