-
Notifications
You must be signed in to change notification settings - Fork 105
84 lines (74 loc) · 2.05 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
82
83
84
name: build-deploy-book
# Only run this when the master branch changes
on:
workflow_dispatch:
push:
branches:
- jupyterbook
permissions:
contents: read
pages: write
id-token: write
# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v4
# Install dependencies
# Install Mambaforge
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
activate-environment: jupyterbook-atlas
- name: Get Date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Conda env
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs
key: "\
conda-${{ runner.os }}-\
${{ runner.arch }}-\
${{ steps.get-date.outputs.today }}-\
${{ hashFiles('binder/conda/environment.yml') }}-\
${{ env.CACHE_NUMBER }}\
"
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
id: cache
- name: Update environment
run:
mamba env update -n jupyterbook-atlas -f
binder/conda/environment.yml
if: steps.cache.outputs.cache-hit != 'true'
# Build the book
- name: Build the book
run: |
jupyter-book build .
# Upload the book's HTML as an artifact
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "_build/html"
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
# Deploy the book's HTML to GitHub Pages
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4