| 1 |
name: Build and Deploy docs |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
push: |
| 6 |
branches: |
| 7 |
- master |
| 8 |
release: |
| 9 |
types: |
| 10 |
- published |
| 11 |
|
| 12 |
# Deny all permissions by default |
| 13 |
permissions: {} |
| 14 |
|
| 15 |
jobs: |
| 16 |
build-docs: |
| 17 |
runs-on: ubuntu-latest |
| 18 |
permissions: |
| 19 |
contents: write |
| 20 |
|
| 21 |
steps: |
| 22 |
- name: checkout |
| 23 |
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 24 |
with: |
| 25 |
fetch-depth: 0 |
| 26 |
persist-credentials: false |
| 27 |
|
| 28 |
- name: Setup Mamba |
| 29 |
uses: mamba-org/setup-micromamba@f457c30a868e4760d3a6fcea5f25dc655b8edf39 # v3.2.1 |
| 30 |
with: |
| 31 |
environment-name: TEST |
| 32 |
create-args: >- |
| 33 |
python=3 |
| 34 |
numpy>1.13.3 |
| 35 |
sphinx |
| 36 |
|
| 37 |
- name: Build environment |
| 38 |
shell: bash -l {0} |
| 39 |
run: | |
| 40 |
python -m pip install -e . --no-deps --force-reinstall |
| 41 |
|
| 42 |
- name: Get the version |
| 43 |
shell: bash -l {0} |
| 44 |
id: get_version |
| 45 |
run: echo "name=VERSION::$(python setup.py --version)" >> $GITHUB_OUTPUT |
| 46 |
|
| 47 |
- name: Build documentation |
| 48 |
shell: bash -l {0} |
| 49 |
run: | |
| 50 |
set -e |
| 51 |
pushd docs |
| 52 |
make html linkcheck O=-W |
| 53 |
popd |
| 54 |
|
| 55 |
- name: Deploy |
| 56 |
if: success() && github.event_name == 'release' |
| 57 |
uses: peaceiris/actions-gh-pages@84c30a85c19949d7eee79c4ff27748b70285e453 # v4.1.0 |
| 58 |
with: |
| 59 |
github_token: ${{ secrets.GITHUB_TOKEN }} |
| 60 |
publish_dir: docs/_build/html |