-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (58 loc) · 2.01 KB
/
pages.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
72
73
name: Deploy documentation to GitHub Pages
on:
workflow_dispatch:
push:
branches: [ main, develop ]
jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install library with docs dependencies
run: |
python3 -m pip install .[docs]
- name: Generate examples and build documentation
run: |
## Init the target folder.
# We will put all site documentation there.
mkdir -p gh-pages
touch gh-pages/.nojekyll
function build_docs {
# The function will checkout a branch and build the API docs & documentation
# into provided directory.
BRANCH=${1}
DOCDIR=${2}
git checkout ${BRANCH}
git fetch
git pull
## Init the target folder.
# We will put all site documentation there.
mkdir -p gh-pages/${DOCDIR}
## Build the docs
# Generate the HTML pages and move the generated content into the target folder.
printf "Building the %s documentation\n" ${DOCDIR}
cd docs
sphinx-apidoc --separate --module-first -d 2 -H "API reference" --follow-links -o apidocs ../src/gpsea
make clean html
# make clean html 2>&1 > /dev/null | less
mv _build/html/* ../gh-pages/${DOCDIR}
cd ..
}
# We store the docs for `main` in `stable` dir
build_docs main stable
# We store the docs for `development` in `latest` dir
build_docs develop latest
- name: Deploy documentation
if: ${{ github.event_name == 'push' }}
uses: JamesIves/github-pages-deploy-action@v4.4.1
with:
branch: gh-pages
force: true
folder: gh-pages