Merge pull request #215 from ImperialCollegeLondon/release-candidates… #198
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: "Sphinx: Render docs" | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v5 | |
with: | |
# Install a specific version of uv. | |
version: "0.5.22" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version-file: "pyproject.toml" | |
- name: Install the project | |
run: | | |
uv venv --seed | |
uv sync --all-extras --frozen | |
sudo apt-get install pandoc | |
- name: Run sphinx-apidoc | |
run: | | |
uv run sphinx-apidoc -f -e -M -o docs/source/api pyprobe | |
- name: Add bibliographies | |
run: | | |
uv run docs/source/_append_footbib.py docs/source | |
- name: Clean old HTML files | |
run: | | |
rm -rf docs/build/html/* | |
- name: Build HTML | |
run: | | |
uv run sphinx-build -b html docs/source docs/build/html | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html-docs | |
path: docs/build/html/ | |
retention-days: 1 | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
permissions: | |
contents: write | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: html-docs | |
path: docs/build/html | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: docs/build/html |