generated from OceanGlidersCommunity/Oxygen_SOP
-
Notifications
You must be signed in to change notification settings - Fork 1
95 lines (84 loc) · 2.56 KB
/
build_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
85
86
87
88
89
90
91
92
93
94
95
name: deploy-site
# Only run this when the main branch changes
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
release:
# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
build:
runs-on: ubuntu-latest
if: github.repository == 'OceanGlidersCommunity/Oxygen_SOP'
defaults:
run:
shell: bash -l {0}
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v3
# Install dependencies
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install -r requirements.txt
# Build the book
- name: Build the book
run: |
jupyter-book build .
# Zip the site (so it can be handed to the preview action)
- name: Zip the site
run: |
set -x
set -e
if [ -f site.zip ]; then
rm -rf site.zip
fi
zip -r site.zip ./_build/html
- uses: actions/upload-artifact@v3
with:
name: site-zip
path: ./site.zip
# Push the site's HTML to github-pages (only if on main, previews are sent to netlify)
- name: Deploy to GitHub pages
if: github.ref == 'refs/heads/main'
uses: peaceiris/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_build/html
enable_jekyll: false
build_pdf:
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: build
defaults:
run:
shell: bash -l {0}
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Install Tex
run: |
sudo apt-get install texlive-latex-recommended texlive-latex-extra \
texlive-fonts-recommended texlive-fonts-extra \
texlive-xetex latexmk
- name: Build the book as pdf #This needs to happen after the site is zipped, since this builds different html that we dont want on the website
run: |
jupyter-book build . --builder pdflatex
- uses: actions/upload-artifact@v3
with:
name: book-pdf
path: _build/latex/python.pdf