-
Notifications
You must be signed in to change notification settings - Fork 35
87 lines (84 loc) · 2.52 KB
/
deploy_sphinx_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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Deploy Sphinx documentation to Pages
on:
pull_request:
types: [opened, synchronize]
paths:
- 'docs/sphinx_doc/**/*'
push:
branches:
- sphinxdoc_page
jobs:
pages:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@master
with:
python_version: ${{ matrix.python-version }}
- name: Choose which pandoc to use
shell: bash
run: |
case $RUNNER_OS in
"Linux")
printf 'INSTALLER_SUFFIX=1-amd64.deb' >> $GITHUB_ENV
;;
"macOS")
printf 'INSTALLER_SUFFIX=macOS.pkg' >> $GITHUB_ENV
;;
*)
printf 'Do not know how to install pandoc on %s\n' "$RUNNER_OS"
exit 1
;;
esac
- name: Download pandoc installer
shell: bash
env:
GITHUB_TOKEN: ${{ github.token }}
REPO: jgm/pandoc
DOWNLOAD_URL: 'https://github.com/jgm/pandoc/releases/download/'
run: |
gh release download ${{ inputs.version }} \
--repo "$REPO" \
--pattern '*'${{ env.INSTALLER_SUFFIX }}
printf 'INSTALLER_VERSION=%s' \
"$(ls pandoc-*-${{ env.INSTALLER_SUFFIX }} | \
sed 's/pandoc-\([0-9.]*\)-.*/\1/')" \
>> $GITHUB_ENV
- name: Install pandoc
shell: bash
env:
INSTALLER: pandoc-${{ env.INSTALLER_VERSION }}-${{ env.INSTALLER_SUFFIX }}
run: |
case $RUNNER_OS in
"Linux")
sudo apt install ./$INSTALLER
;;
"macOS")
sudo installer -pkg ./$INSTALLER -target '/'
;;
*)
echo "$RUNNER_OS not supported"
exit 1
;;
esac
rm $INSTALLER
- name: Install sphinx dependencies
run: |
python -m pip install --upgrade pip
pip install -r docs/sphinx_doc/requirements.txt
- name: Build documentation
run: |
cd docs/sphinx_doc
bash build_sphinx_doc.sh
- name: Upload documentation
uses: actions/upload-artifact@v3
with:
name: SphinxDoc
path: 'docs/sphinx_doc/build/html'
- uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/sphinxdoc_page' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: 'docs/sphinx_doc/build/html'