-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (75 loc) · 2.46 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: 'Documentation'
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: true
on:
push:
branches:
- main
pull_request:
types: [closed]
branches: [main]
release:
types: [published]
jobs:
build_and_deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get git tags
run: git fetch --prune --unshallow --tags
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Build package
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Install sphinx
run: pip install sphinx sphinx-tabs sphinx-copybutton sphinx-autodoc-typehints sphinx-argparse
- name: Install sphinx theme
run: pip install pydata-sphinx-theme
- name: Install other dependencies
run: pip install plams
- name: Run sphinx-apidoc
run: cd docs; sphinx-apidoc -f -o ./api ../src/tcutility
- name: Run python scripts that create files used for the build docs
# script are in root/docs/utility_doc_scripts
run: |
for script in docs/utility_doc_scripts/*.py; do
python $script
done
- name: Build the docs
run: cd docs; make html
- name: Upload build to repo
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Documentation build
file_pattern: 'docs/*'
add_options: '-f'
status_options: '-uall --ignored'
push_options: '--force'
branch: main
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: './docs/_build/html/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2