-
Notifications
You must be signed in to change notification settings - Fork 4
73 lines (56 loc) · 1.63 KB
/
build_pdf.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
name: Build PDF of the Book
# This Workflow was adapted from the official docs:
# https://github.com/executablebooks/jupyter-book
on:
push:
branches: source
workflow_dispatch:
repository_dispatch:
jobs:
pdf_from_latex:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install wheel
pushd .
cd ..
git clone https://github.com/executablebooks/jupyter-book.git
cd jupyter-book
pip install -e .[sphinx,pdflatex]
popd
- name: Install latex dependencies
run: |
sudo apt-get -qq update
sudo apt-get install -y \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-extra \
fonts-freefont-otf \
texlive-xetex \
latexmk \
xindy
- name: Build PDF from LaTeX
run: jb build . --builder latex -n -W --keep-going
- name: Crop Images
run: mogrify -trim _build/jupyter_execute/chapters/*.png
- name: Build PDF from LaTeX
run: |
cd _build/latex
make all-pdf
- uses: actions/upload-artifact@v2
with:
name: Book PDF
path: _build/latex/python.pdf