-
Notifications
You must be signed in to change notification settings - Fork 20
81 lines (70 loc) · 2.67 KB
/
book.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
name: build-book
# only run when specific files change
# only run on install-fix-docs branch
# TODO change this to dev/main branch once integrated
on:
push:
branches:
- master
- dev
jobs:
build-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Fetch tag manually because fetch-tags option for checkout@v4 does not work
- name: Fetch tag annotations
run: |
# Fetch tag manually because fetch-tags option for checkout@v4 does not work
git fetch --force --tags --depth 1
- id: read_tag
name: Set VERSION env variable
if: ${{ startsWith(github.ref, 'refs/tags') }}
run: |
# Set tag from GitHub: using git describe for tags inside the run script
# seems not working
echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
steps:
- uses: actions/checkout@v3
- name: Setup Graphviz
uses: ts-graphviz/setup-graphviz@v1
# install python
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
# set up pygom
- name: Build and install pygom
run: |
python -m pip install --upgrade pip
pip install .
# install dependencies
- name: Install documentation dependencies
run: |
pip install -r docs/requirements.txt
# build the book
# TODO check which flags are needed, -W
- name: Build the book
run: |
jupyter-book build --all -v docs/
# deploy book to github-pages
- name: GitHub Pages
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
# deploy book to github-pages dev
- name: GitHub Pages dev
uses: peaceiris/actions-gh-pages@v4
if: github.ref == 'refs/heads/dev'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_build/html
destination_dir: dev