generated from ProjectPythia/cookbook-template
-
Notifications
You must be signed in to change notification settings - Fork 11
80 lines (77 loc) · 2.7 KB
/
build-book-pullrequest.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
75
76
77
78
79
80
name: build-book-pullrequest
on:
workflow_call:
inputs:
environment_name:
description: 'Name of conda environment to activate'
required: false
default: 'cookbook-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: './'
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-book:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: checkout files in repo
uses: actions/checkout@v3
- name: remove Dockerfile
run: |
rm binder/Dockerfile
- name: update jupyter dependencies with repo2docker
uses: jupyterhub/repo2docker-action@master
with:
NO_PUSH: true
DOCKER_USERNAME: "openradar"
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
DOCKER_REGISTRY: "ghcr.io"
PUBLIC_REGISTRY_CHECK: true
APPENDIX_FILE: "binder/appendix.txt"
REPO2DOCKER_EXTRA_ARGS: --Repo2Docker.base_image=docker.io/library/buildpack-deps:bionic
FORCE_REPO2DOCKER_VERSION: jupyter-repo2docker==2022.02.0
- name: list docker images
run: |
docker image ls -a
- name: Build the book
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/openradar/erad2022:latest
options: --user root -v ${{ github.workspace }}:/work
shell: bash -l {0}
run: |
# copy baltrad notebooks to book dir
cp -rp /home/jovyan/notebooks/baltrad* /work/notebooks/.
cp -rp /home/jovyan/notebooks/pyart2baltrad* /work/notebooks/.
/work/install/nbstripout_notebooks.sh
source /srv/conda/etc/profile.d/conda.sh
conda activate notebook
jupyter-book build /work/${{ 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