avoid crashing when census site is down #441
Workflow file for this run
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: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
paths: | |
- tests/* | |
- hydromt_fiat/* | |
- docs/* | |
- examples/* | |
- pyproject.toml | |
pull_request: | |
branches: [ main ] | |
paths: | |
- tests/* | |
- hydromt_fiat/* | |
- docs/* | |
- examples/* | |
- pyproject.toml | |
jobs: | |
# Build docs on Linux | |
Docs: | |
name: linux docs | |
runs-on: ubuntu-latest | |
env: | |
DOC_VERSION: dev | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
python-version: "3.10" | |
miniforge-version: latest | |
channels: conda-forge | |
use-mamba: true | |
- name: Install and activate environment | |
run: | | |
mamba env create -f envs/hydromt-fiat-docs.yml | |
conda activate hydromt-fiat-docs | |
pip install . | |
- 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-fiat-docs sphinx-build -M html ./docs ./docs/_build | |
echo "DOC_VERSION=$(mamba run -n hydromt-fiat-docs python -c 'from hydromt_fiat 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 |