-
Notifications
You must be signed in to change notification settings - Fork 45
55 lines (46 loc) · 1.38 KB
/
build-book.yaml
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
name: build-book
on:
pull_request:
env:
CACHE_NUMBER: 0 # increase to reset cache manually
jobs:
build-and-upload:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v4
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: book-render
use-mamba: true
- name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
path: /usr/share/miniconda3/envs/book-render
key: linux-64-conda-${{ hashFiles('render-environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache
- name: Update environment
if: steps.cache.outputs.cache-hit != 'true'
run: mamba env update -n book-render -f render-environment.yml
- name: Build the book
run: |
jupyter-book build .
- name: Zip the book
run: |
set -x
set -e
if [ -f book.zip ]; then
rm -rf book.zip
fi
zip -r book.zip _build/html
- name: Upload zipped book artifact
uses: actions/upload-artifact@v4
with:
name: book-zip-${{github.event.number}}
path: ./book.zip