-
Notifications
You must be signed in to change notification settings - Fork 15
70 lines (63 loc) · 2.16 KB
/
docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Build Documentation
on:
workflow_dispatch:
push:
branches: [main]
paths:
- .github/workflows/docs.yml
- hydromt_sfincs/*
- docs/*
- examples/*
- pyproject.toml
pull_request:
branches: [main]
paths:
- .github/workflows/docs.yml
- hydromt_sfincs/*
- docs/*
- examples/*
- pyproject.toml
jobs:
# Build docs on Linux
test-docs:
env:
DOC_VERSION: dev
PYDEVD_DISABLE_FILE_VALIDATION: 1
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
python-version: '3.11'
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
- name: Setup env
run: |
python make_env.py full -p 3.11 -n hydromt-sfincs -o environment-doc.yml
mamba env create -f environment-doc.yml
mamba run -n hydromt-sfincs pip install -e .
# 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: Build dummy docs
if: ${{ github.event_name == 'pull_request' }}
run: |
mamba run -n hydromt-sfincs sphinx-build ./docs ./docs/_build -b dummy -W
- name: Build html docs
if: ${{ github.event_name != 'pull_request' }}
run: |
mamba run -n hydromt-sfincs sphinx-build -M html ./docs ./docs/_build -W
echo "DOC_VERSION=$(mamba run -n hydromt-sfincs python -c 'from hydromt_sfincs import __version__ as v; print("dev" if "dev" in v else "v"+v)')" >> $GITHUB_ENV
- name: Upload to GitHub Pages
if: ${{ github.event_name != 'pull_request'}}
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