-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (53 loc) · 1.81 KB
/
Copy pathbuild_docs.yml
File metadata and controls
69 lines (53 loc) · 1.81 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
name: Build Docs
on:
push:
branches:
- master
- main
- dev
pull_request:
branches:
- master
- main
- dev
jobs:
build_docs:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.14'
cache: 'pip'
- name: Update Pip
run: |
python -m pip install --upgrade pip
- name: Install dependencies
# note that we also install the sphinx template, here. If you change the template (see `docs/source/conf.py`)
run: |
pip install sphinx pydata-sphinx-theme
- name: Sphinx build
run: |
sphinx-apidoc -o docs/source/_autogen .
sphinx-build -M html docs/source docs/build
- name: Push to branch
run: |
git diff --quiet || git stash --quiet
git checkout -B "gh-docs-${{steps.extract_branch.outputs.branch}}"
if git stash list | grep -q "stash@{0}"; then
git stash pop --quiet || { echo "Unexpected conflict during stash."; exit 1; }
fi
git config --global user.name "github-actions[bot]"
git config --global user.email "docbot@users.noreply.github.com"
git add .
git add -f docs/build/html
git diff-index --quiet HEAD || git commit -m "docs: auto-generated documentation update [skip ci]"
git push --force origin "gh-docs-${{steps.extract_branch.outputs.branch}}"