aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/docs.yaml
blob: c606cad74b2791fcfc375bd6140c564030469b75 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Build Docs

on:
  workflow_dispatch:
  workflow_call:

jobs:
  latest-build:
    # We only need to verify that the docs build with no warnings here
    name: Build Latest Docs Version
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - name: Install uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
          resolution-strategy: "lowest"
          cache-dependency-glob: "uv.lock"
          activate-environment: true

      - name: Install dependencies
        run: uv sync --locked --group doc --extra async-rediscache

      - name: Generate HTML Site
        run: sphinx-build -nW -j auto -b html docs docs/build

      - name: Upload Build Artifact
        uses: actions/upload-artifact@v4
        with:
          name: docs-latest
          path: docs/build/*

  build-deploy:
    name: Build & Deploy Docs
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0  # We need to check out the entire repository to find all tags

      - name: Install uv
        uses: astral-sh/setup-uv@v7
        with:
          enable-cache: true
          resolution-strategy: "lowest"
          cache-dependency-glob: "uv.lock"
          activate-environment: true

      - name: Install dependencies
        run: uv sync --locked --group doc --extra async-rediscache

      - name: Build All Doc Versions
        run: sphinx-multiversion docs docs/build -n -j auto
        env:
          BUILD_DOCS_FOR_HEAD: ${{ github.event_name == 'pull_request' }}
          BRANCH_NAME: ${{ github.head_ref }}

      - name: Remove Metadata Files
        run: |
          rm -r docs/build/**/_sources
          rm -r docs/build/**/.doctrees

      - name: Upload Build Artifact
        uses: actions/upload-artifact@v4
        with:
          name: docs
          path: docs/build/*

      - name: Deploy To GitHub Pages
        uses: JamesIves/github-pages-deploy-action@v4
        with:
          branch: docs
          folder: docs/build
          # We only want to actually push the build if we're on main, otherwise just make sure everything works
          dry-run: ${{ github.ref != 'refs/heads/main' }}