Skip to content

Build and Deploy Docs #122

Build and Deploy Docs

Build and Deploy Docs #122

Workflow file for this run

name: Build and Deploy Docs
on:
workflow_dispatch:
inputs:
# trunk-ignore(checkov/CKV_GHA_7)
version:
description: Version to publish
required: true
type: string
set_latest:
description: Point the `latest` alias at this version (uncheck for pre-releases)
required: false
default: true
type: boolean
concurrency:
group: pages
cancel-in-progress: true
permissions:
contents: write # Needed to push to gh-pages
pages: write # Needed if using GitHub Pages
id-token: write # Needed for OIDC authentication (optional, for Pages API)
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v4.3.0
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6.7.0
with:
enable-cache: true
cache-dependency-glob: uv.lock
- name: Set up Python
uses: actions/setup-python@v6.0.0
with:
python-version-file: .python-version
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Set Git user
run: |
git config --global user.name ${{ secrets.GIT_NAME }}
git config --global user.email ${{ secrets.GIT_EMAIL }}
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
git fetch -a
git pull origin main
git checkout gh-pages
git pull origin gh-pages
git checkout main
- name: Refresh generated snippets
run: |
uv run python -m scripts.gen_env_vars
uv run python -m scripts.gen_scheduled_tasks
# The site root redirects to `latest/`, so that alias is what decides
# where visitors land. A pre-release deploys without it, reachable at
# its own URL and listed in the version dropdown, but not the default.
- name: Build the documentation
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ github.event.inputs.version }}
SET_LATEST: ${{ github.event.inputs.set_latest }}
run: |
set -euo pipefail
if [ "$SET_LATEST" = "false" ]; then
uv run mike deploy --push "$VERSION"
else
uv run mike deploy --push --update-aliases "$VERSION" latest
fi