Skip to content

fix github env syntax (#1073) #4

fix github env syntax (#1073)

fix github env syntax (#1073) #4

Workflow file for this run

---
name: Build Documentation
on:
workflow_dispatch:
push:
branches: [main]
paths:
- tests/*
- hydromt/*
- data/*
- docs/*
- examples/*
- pyproject.toml
- .github/workflows/docs.yml
pull_request:
branches: [main]
paths:
- tests/*
- hydromt/*
- data/*
- docs/*
- examples/*
- pyproject.toml
- .github/workflows/docs.yml
jobs:
test-docs:
defaults:
run:
shell: bash -e -l {0}
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
- uses: prefix-dev/[email protected]
with:
pixi-version: "v0.21.1"
environments: full-py311
- name: Prepare pixi
run: |
pixi run --locked -e full-py311 install-hydromt
# 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: |
pixi run --locked -e full-py311 sphinx-build ./docs ./docs/_build -b dummy -W
- name: Generate docs
if: ${{ github.event_name != 'pull_request' }}
run: |
pixi run --locked -e full-py311 docs
export CURRENT_VERSION=$(grep "__version__" hydromt/__init__.py | cut -d= -f 2 | tr -d "\" ")
if [ -z "$CURRENT_VERSION" ]; then
echo "Could not determine version, exiting..."
exit 1
fi
# Are we a dev version or not?
if echo "$CURRENT_VERSION" | grep -q "dev"; then
# If it's a dev version, just echo "dev"
echo "DOC_VERSION=dev" >> "$GITHUB_ENV"
else
# Otherwise, echo the version number
echo "DOC_VERSION=v$CURRENT_VERSION" >> "$GITHUB_ENV"
fi
- 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