Skip to content

Commit 9023e72

Browse files
committed
Publish docs using GHA
1 parent b31f38f commit 9023e72

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

.github/workflows/docs.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: CD
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
release:
10+
types:
11+
- published
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
env:
18+
# Many color libraries just need this to be set to any value, but at least
19+
# one distinguishes color depth, where "3" -> "256-bit color".
20+
FORCE_COLOR: 3
21+
22+
jobs:
23+
docs-build:
24+
name: Documentation build
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- uses: astral-sh/setup-uv@v7
34+
35+
- name: Set up Python ${{ matrix.python-version }}
36+
uses: actions/setup-python@v2
37+
with:
38+
python-version: ${{ matrix.python-version }}
39+
40+
- name: Install
41+
shell: bash -l {0}
42+
run: source continuous_integration/scripts/install.sh
43+
44+
- name: Install docs requirements
45+
shell: bash -l {0}
46+
run: |
47+
set -vxeuo pipefail
48+
python -m pip install -r requirements-docs.txt
49+
python -m pip list
50+
51+
- name: Build HTML
52+
run: sphinx-build docs docs/_build/html
53+
54+
- name: Upload HTML as GitHub artifact
55+
uses: actions/upload-pages-artifact@v3
56+
with:
57+
path: docs/_build/html
58+
59+
docs-publish:
60+
name: Deploy documentation to GitHub Pages
61+
runs-on: ubuntu-latest
62+
needs: docs-build
63+
if: ${{ github.ref_name == 'main' }}
64+
65+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
66+
permissions:
67+
contents: read
68+
pages: write
69+
id-token: write
70+
71+
environment:
72+
name: github-pages
73+
url: ${{ steps.deployment.outputs.page_url }}
74+
75+
steps:
76+
- name: Setup GitHub Pages
77+
uses: actions/configure-pages@v5
78+
79+
- name: Deploy HTML to GitHub Pages
80+
id: deployment
81+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)