-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (60 loc) · 2.14 KB
/
main.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
name: deploy-book
# Only run this when the master branch changes
on:
push:
branches:
- master
# If your git repository has the Jupyter Book within some-subfolder next to
# unrelated files, you can make this run only if a file within that specific
# folder has been modified.
#
# paths:
# - some-subfolder/**
# This job installs dependencies, build the book, and pushes it to `gh-pages`
jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
# Install Python
- name: Set up Python 3.7
uses: actions/setup-python@v1
with:
python-version: 3.7
# Install the python packages (from requirements.txt)
- name: Install python packages
run: |
pip install -r requirements.txt
# Install the latex things to create the pdf
- name: install latex dependencies
run: |
sudo apt-get update
sudo apt-get install texlive-latex-recommended texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra texlive-xetex latexmk
# Build the html version of the book
- name: Build the html-book
run: |
jupyter-book build .
- name: Build the pdf book
run: |
jupyter-book build . --builder pdflatex --toc _toc_latex.yml
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
# This next step moves, renames and commits the created pdf
- name: Commit and rename pdf
run: |
mv ./_build/latex/book.pdf book.pdf
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add book.pdf
git commit -m "update PDF version of the book"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}