-
Notifications
You must be signed in to change notification settings - Fork 28
76 lines (65 loc) · 2.42 KB
/
publish-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
name: publish-book
on:
workflow_dispatch:
env:
NB_KERNEL: python
NMA_REPO: climate-course-content
NMA_MAIN_BRANCH: main
PREREQ_INTRO: ClimateScience
ORG: neuromatch
# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
build-books-and-deploy:
runs-on: climate_runner
# runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Get commit message
run: |
readonly local msg=$(git log -1 --pretty=format:"%s")
echo "COMMIT_MESSAGE=$msg" >> $GITHUB_ENV
- name: Setup
uses: ./.github/actions/setup
with:
force_env_update: 'false'
# Cache not currently working. May conflict with Cache in setup
# Unsure if the cache in setup works properly either
# - name: Cache Jupyter Build Artifacts
# uses: actions/cache@v3
# with:
# path: |
# ./book/_build/html/
# ./.jupyter_cache
# key: ${{ runner.os }}-jupyter-${{ hashFiles('**/*.ipynb') }}
# restore-keys: |
# ${{ runner.os }}-jupyter-
- name: Build student book
run: |
# TODO: get this working with a general CI
# python ci/generate_book_climate.py student
python ci/generate_book.py student
jupyter-book toc migrate /home/runner/work/climate-course-content/climate-course-content/book/_toc.yml -o /home/runner/work/climate-course-content/climate-course-content/book/_toc.yml
ln -s ../tutorials book/tutorials
ln -s ../projects book/projects
# ln -s ../prereqs book/prereqs
jupyter-book build book
python ci/parse_html_for_errors.py student
shell: bash -l {0}
# NOTE: we may be able to push striaght from here. ie skip the last flow
- name: Commit book
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
ghp-import -n -c "comptools.climatematch.io" -m "Update course book" book/_build/html
git checkout -f gh-pages
- name: Publish to gh-pages
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
force: true