-
Notifications
You must be signed in to change notification settings - Fork 1
71 lines (62 loc) · 1.97 KB
/
build-docs.yml
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
name: Sphinx Documentation
on:
push:
branches: [main]
defaults:
# always run commands in the main repository:
run:
working-directory: main
jobs:
build:
# When releasing, there is a race condition in building the
# documentation. Two commits are pushed in quick succession:
#
# 1. The release commit
# 2. The commit that bumps the version to the new dev version
#
# Without the following conditional to skip the documentation build for
# that second commit, both commits would trigger workflows that starts
# around the same time, and the one that finishes first would cause the
# other to fail when it tries to make a conflicting commit.
#
# Note: testing array[n] for null is the GitHub Actions way of checking
# if the length of an array is <= n.
if: >-
!(github.event.commits[1] == null
&& startsWith(github.event.head_commit.message, 'Begin work on v'))
runs-on: ubuntu-20.04
# Clones the repo TWICE, once for each branch: main and gh-pages
#
# Will build in "main" and then copy JUST THE HTML to "gh-pages"!
#
# .
# ├── gh-pages (destination)
# │ └── index.html
# └── main (source)
# └── docs
# └── _build
# └── html
# └── index.html
steps:
- name: Checkout main
uses: actions/checkout@v2
with:
path: main
- name: Checkout documentation branch
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
- uses: actions/setup-python@v2
with:
python-version: 3.9
# Build
- run: pip install pipenv==2021.5.29
- run: pipenv install --dev
- run: pipenv run make -C python docs
- run: cp -a python/docs/_build/html/. ${GITHUB_WORKSPACE}/gh-pages/
# Commit and push!
- uses: EndBug/add-and-commit@v7
with:
cwd: gh-pages
branch: gh-pages