-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (63 loc) · 2.5 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
67
68
69
70
71
72
# Modified from: https://github.com/choldgraf/deploy_configurations/blob/master/.github/workflows/main.yml
# Note: lint with https://rhysd.github.io/actionlint/
name: Publish JupyterBook to GitHub Pages
on:
push: # trigger build only when push to master
branches:
- main
- test-gh-actions # GH actions test branch
permissions:
id-token: write
pages: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.10.15
- name: Install Python dependencies
run: |
sudo apt-get install python3-pip
pip install numpy
pip install sympy
pip install matplotlib
pip install jupyter-book
pip install ghp-import
PATH="${PATH}:${HOME}/.local/bin"
- name: Build book HTML
run: |
jupyter-book build ./book
- name: Push built book HTML as artifact
uses: actions/upload-pages-artifact@v33eq
with:
path: "book/_build/html"
- name: Deploy book HTML to Github Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Build PDF of book
run: |
sudo apt-get update
# TeX tools
sudo apt-get install texlive-latex-extra \
texlive-fonts-extra \
texlive-xetex latexmk
# Image tools
sudo apt install libpng-dev libjpeg-dev libtiff-dev imagemagick
# Build actual book
jupyter-book build book --builder pdflatex
mv book/_build/latex/python.pdf book/_build/elara-handbook.pdf
- name: Upload book PDF to Github releases
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
pip install github-release-retry
github-release-retry \
--user elaraproject \
--repo elara-handbook \
--tag_name v0.0.0-$(git rev-parse HEAD | cut -c 1-8) \
--prerelease \
--body_string "Automatically generated from book sources via Github Actions" \
book/_build/elara-handbook.pdf