-
-
Notifications
You must be signed in to change notification settings - Fork 271
91 lines (77 loc) · 2.31 KB
/
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
name: Build Documentation
on:
workflow_dispatch:
workflow_call:
inputs:
publish:
required: true
type: boolean
release:
types: [ released ]
jobs:
build_docs:
name: Build Documentation
runs-on: ubuntu-latest
steps:
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch the complete repo history (for setuptools-scm)
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: pip-cache-${{ hashFiles('requirements/*.txt') }}
restore-keys: |
pip-cache
- name: Install python requirements
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build twine
python -m pip install -r requirements/dev.txt
- name: Create cache directory
run: |
mkdir doc_cache # make sure cache dir exists
- name: Cache FastF1
uses: actions/cache@v3
with:
path: ./doc_cache
key: fastf1-doc-cache-${{ hashFiles('*.*') }}
restore-keys: |
fastf1-doc-cache
- name: Install Fast-F1 from sources
run: |
python -m pip install -e .
- name: Create doc build dir
run: |
mkdir -p docs/_build/html
- name: Checkout current docs
uses: actions/checkout@v3
with:
ref: gh-pages
path: docs/_build/html
- name: Build docs
run: |
mkdir test_cache # not really need but pytest setup relies on it
cd ./docs
make clean
make html
- name: Publish docs
if: (github.event_name == 'release') || inputs.publish
run: |
cd docs/_build/html
git add .
git config user.name github-actions
git config user.email [email protected]
git commit -m "$GITHUB_REF_NAME ($GITHUB_JOB) ci release"
git push origin gh-pages --force
- name: Upload docs as artifact
uses: actions/upload-artifact@v3
if: github.event_name != 'release'
with:
name: Documentation Build
path: docs/_build/html