Skip to content

Switch to pathlib & run prek #4

Switch to pathlib & run prek

Switch to pathlib & run prek #4

Workflow file for this run

---
name: Documentation
on:
push:
pull_request:
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
artifacts-name: docs
python-version: "3.12"
jobs:
build-docs:
name: Build docs
runs-on: ['ubuntu-latest']
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up Python ${{ env.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ env.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
- name: Set up cache
uses: actions/cache@v4
id: cached-poetry-dependencies
with:
path: .venv
key: venv-${{ runner.os }}-${{ env.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: venv-${{ runner.os }}-${{ env.python-version }}-
- name: Install dependencies
run: poetry install --no-interaction --all-extras
- name: Build dependencies
run: poetry build
- name: Build MkDocs docs
env:
JUPYTER_PLATFORM_DIRS: 1
run: poetry run mkdocs build -f ./docs/mkdocs.yml -d ./_build/
- name: Upload build artifacts
uses: actions/upload-artifact@v5
with:
name: ${{ env.artifacts-name }}
path: ./docs/_build/
if: ${{ always() }}
deploy-docs:
name: Deploy docs
needs: build-docs
permissions:
pages: write
id-token: write
runs-on: ['ubuntu-latest']
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Download Artifacts
uses: actions/download-artifact@v6
with:
path: artifacts
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
# path: artifacts/${{ env.artifacts-name }}/
path: artifacts/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4