-
Notifications
You must be signed in to change notification settings - Fork 6
79 lines (70 loc) · 2.22 KB
/
Copy pathdocs.yml
File metadata and controls
79 lines (70 loc) · 2.22 KB
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: Docs
on:
push:
branches:
- main
- 'release-[0-9]*.[0-9]*'
tags:
# GitHub tag globs are not regexes. The plan step below enforces final
# vMAJOR.MINOR.PATCH tags and skips pre-release tags that also match.
- 'v[0-9]*.[0-9]*.[0-9]*'
workflow_dispatch:
concurrency:
group: deploy-docs
cancel-in-progress: false
jobs:
deploy-docs:
name: Build and deploy docs
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: write
env:
POETRY_VIRTUALENVS_CREATE: "false"
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Fetch gh-pages branch
shell: bash
run: |
if git ls-remote --exit-code --heads origin gh-pages >/dev/null 2>&1; then
git fetch origin gh-pages:gh-pages
else
echo "origin has no gh-pages branch yet; this will bootstrap it."
fi
- name: Determine docs deployment
id: docs
shell: bash
run: |
python dev/deploy_docs.py plan \
--github-ref "$GITHUB_REF" \
--github-output "$GITHUB_OUTPUT"
- uses: actions/setup-python@v6
if: steps.docs.outputs.skip != 'true'
with:
python-version: "3.12"
cache: 'pip'
cache-dependency-path: 'poetry.lock'
- name: Install docs dependencies
if: steps.docs.outputs.skip != 'true' && steps.docs.outputs.metadata_only != 'true'
run: |
pip install poetry
poetry install --with docs
- name: Build Sphinx documentation
if: steps.docs.outputs.skip != 'true' && steps.docs.outputs.metadata_only != 'true'
run: |
DOC_VERSION="${{ steps.docs.outputs.version }}" \
poetry run sphinx-build -E -a docs public/html
- name: Deploy to gh-pages
if: steps.docs.outputs.skip != 'true'
shell: bash
run: |
flag=""
if [[ "${{ steps.docs.outputs.metadata_only }}" == "true" ]]; then
flag="--metadata-only"
fi
python dev/deploy_docs.py deploy \
--version "${{ steps.docs.outputs.version }}" \
$flag
git push origin gh-pages