-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (71 loc) · 2.54 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
name: docs
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pages: write
id-token: write
jobs:
build_docs:
name: Build docs
runs-on: ubuntu-latest
steps:
- name: Avoid git conflicts when tag and branch pushed at same time
if: github.ref_type == 'tag'
run: sleep 60
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install ffmpeg
uses: FedericoCarboni/setup-ffmpeg@v3
- name: Install opencv
run: python -m pip install opencv-python-headless ipywidgets "numpy<2.0"
- name: Checkout code
uses: actions/checkout@v4
- name: Install optimap
run: python -m pip install .[docs]
- name: Cache excample file downloads
uses: actions/cache@v4
with:
path: |
docs/tutorials/optimap_example_data
key: optimap-example-files
- name: Cache jupyter notebook cache
uses: actions/cache@v4
with:
path: |
docs/.jupyter_cache
key: docs-jupyter-cache
- name: Build docs
run: |
jcache notebook -p docs/.jupyter_cache list
python -m sphinx -b dirhtml --doctree-dir docs/doctrees docs docs/_build
find docs/_build -iname '.jupyter_cache' # should be empty but sometimes it's not
find docs/_build -iname '.jupyter_cache' -exec rm -rf {} \;
env:
TQDM_MININTERVAL: 20
- name: Sanitize ref name for docs version
run: echo "DOCS_VERSION=${GITHUB_REF_NAME//[^A-Za-z0-9._-]/_}" >> $GITHUB_ENV
- name: Move to versioned directory
run: mv docs/_build .github/pages/$DOCS_VERSION
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: .github/pages
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build_docs
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4