generated from ProjectPythia/cookbook-template
-
Notifications
You must be signed in to change notification settings - Fork 13
74 lines (71 loc) · 2.3 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: build-book
on:
workflow_call:
inputs:
environment_name:
description: 'Name of conda environment to activate'
required: false
default: 'ams-open-radar-2023-dev'
type: string
environment_file:
description: 'Name of conda environment file'
required: false
default: 'environment.yml'
type: string
path_to_notebooks:
description: 'Location of the JupyterBook source relative to repo root'
required: false
default: 'notebooks'
type: string
use_cached_environment:
description: 'Flag for whether we should attempt to retrieve a previously cached environment.'
required: false
default: 'true'
type: string # had a lot of trouble with boolean types, see https://github.com/actions/runner/issues/1483
jobs:
build-container:
runs-on: ubuntu-latest
steps:
- name: checkout files in repo
uses: actions/checkout@main
- name: remove Dockerfile
run: |
rm binder/Dockerfile
- name: update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with:
DOCKER_USERNAME: "openradar"
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REGISTRY: "ghcr.io"
PUBLIC_REGISTRY_CHECK: true
APPENDIX_FILE: "binder/appendix.txt"
build-book:
runs-on: ubuntu-latest
container:
image: ghcr.io/openradar/ams-open-radar-2023:latest
options: --user root
needs: [build-container]
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Build the book
run: |
# copy baltrad notebooks to book dir
cp -rp /home/jovyan/notebooks/baltrad* notebooks/.
cp -rp /home/jovyan/notebooks/pyart2baltrad* notebooks/.
jupyter-book build ${{ inputs.path_to_notebooks }}
- name: Zip the book
run: |
set -x
set -e
if [ -f book.zip ]; then
rm -rf book.zip
fi
zip -r book.zip ${{ inputs.path_to_notebooks }}/_build/html
- name: Upload zipped book artifact
uses: actions/upload-artifact@v3
with:
name: book-zip-${{github.event.number}}
path: ./book.zip