Skip to content

Release v0.9.1 (#652) #1559

Release v0.9.1 (#652)

Release v0.9.1 (#652) #1559

Workflow file for this run

---
name: Build Documentation
on:
workflow_dispatch:
push:
branches: [main]
paths:
- tests/*
- hydromt/*
- data/*
- docs/*
- examples/*
- pyproject.toml
pull_request:
branches: [main]
paths:
- tests/*
- hydromt/*
- data/*
- docs/*
- examples/*
- pyproject.toml
jobs:
test-docs:
defaults:
run:
shell: bash -l {0}
env:
DOC_PYTHON_VERSION: '3.11'
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
# we need environment.yml to see if we have a cache hit
- name: Generate env spec
run: pip install tomli && python make_env.py test,io,extra,doc -p ${{ env.DOC_PYTHON_VERSION }} -n hydromt
- name: load from cache
id: cache
uses: actions/cache/restore@v3
with:
path: |
/usr/share/miniconda3
~/pycache
./docs/_build
# the below two settings mean we'll alway srestore the cache
# but the cache hit output can tell us if we have to update afterwards
key: docs-${{ hashFiles('environment.yml') }}
restore-keys: |
docs
- name: Fail on no cache restore
if: steps.cache.outputs.cache-matched-key == ''
run: |
echo "Failed to restore any cache. exiting..."
exit 1
# by avoiding the mamba setup stage by loading it from cache instead we save
# a lot of setup time, but we do have to do our own PATH management
# hence the exports
- name: Update environment
if: steps.cache.outputs.cache-hit != 'true'
run: |
export PATH=/usr/share/miniconda3/bin:$PATH
mamba env update -n hydromt -f environment.yml
# if we're not publishing we don't have to write them, so we might as well
# save ourself a bunch of IO time
- name: Generate dummy docs
if: ${{ github.event_name == 'pull_request' }}
run: |
export PATH=/usr/share/miniconda3/bin:$PATH
PYTHONPYCACHEPREFIX=~/pycache mamba run -n hydromt sphinx-build ./docs ./docs/_build -b dummy -W
- name: Generate docs
if: ${{ github.event_name != 'pull_request' && !github.event.act }}
run: |
export PATH=/usr/share/miniconda3/bin:$PATH
PYTHONPYCACHEPREFIX=~/pycache mamba run -n hydromt sphinx-build -M html ./docs ./docs/_build -W
echo "DOC_VERSION=$(mamba run -n hydromt python -c 'from hydromt import __version__ as v; print("dev" if "dev" in v else "v"+v.replace(".dev",""))')" >> $GITHUB_ENV
- name: Upload to GitHub Pages
if: ${{ github.event_name != 'pull_request' && !github.event.act }}
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
exclude_assets: .buildinfo,_sources/*,_examples/*.ipynb
destination_dir: ./${{ env.DOC_VERSION }}
keep_files: false
full_commit_message: Deploy ${{ env.DOC_VERSION }} to GitHub Pages