-
Notifications
You must be signed in to change notification settings - Fork 521
74 lines (64 loc) · 1.96 KB
/
deploy-gh-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
74
name: deploy-gh-pages
on:
push:
branches:
- main
- test-ci*
pull_request:
branches:
- main
jobs:
deploy-gh-pages:
runs-on: ubuntu-latest
env:
OMP_NUM_THREADS: 1
MKL_NUM_THREADS: 2
OPENBLAS_NUM_THREADS: 2
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
- name: Cache jupyter-cache folder
uses: actions/cache@v3
env:
cache-name: jupyter-cache
with:
path: jupyter-book/_build/.jupyter_cache
key: v2-${{ github.ref }}-${{ hashFiles('python_scripts/**/*.py') }}
restore-keys: |
v2-${{ github.ref }}-${{ hashFiles('python_scripts/**/*.py') }}
v2-${{ github.ref }}
v2-refs/heads/main
- name: Build the JupyterBook
env:
GITHUB_PULL_REQUEST_NUMBER: ${{github.event.number}}
run: |
bash build_tools/build_jupyter_book.sh
- name: Save the PR number
env:
GITHUB_PULL_REQUEST_NUMBER: ${{github.event.number}}
run: |
echo "Storing PR number ${{github.event.number}} to 'pull_request_number' file"
echo ${{github.event.number}} > pull_request_number
- name: Upload jupyter-book artifact for preview in PRs
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v3
with:
name: jupyter-book
path: |
jupyter-book/_build/html
pull_request_number
- name: Update the main gh-page website
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./jupyter-book/_build/html
commit_message: "[ci skip] ${{ github.event.head_commit.message }}"