Skip to content

Commit 113407c

Browse files
committed
Add GitHub Pages publish workflow with PDF download link
1 parent d451c65 commit 113407c

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

.github/workflows/publish.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Publish Book
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch: # Allow manual triggers
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: false
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: '3.12'
30+
cache: 'pip'
31+
32+
- name: Set up Quarto
33+
uses: quarto-dev/quarto-actions/setup@v2
34+
with:
35+
version: '1.6.40'
36+
37+
- name: Install TeX Live
38+
run: |
39+
sudo apt-get update
40+
sudo apt-get install -y --no-install-recommends \
41+
texlive-latex-base \
42+
texlive-latex-recommended \
43+
texlive-latex-extra \
44+
texlive-fonts-recommended \
45+
texlive-fonts-extra \
46+
texlive-science \
47+
texlive-pictures \
48+
texlive-bibtex-extra \
49+
texlive-plain-generic \
50+
lmodern \
51+
biber \
52+
latexmk \
53+
cm-super \
54+
dvipng \
55+
ghostscript
56+
57+
- name: Install Python dependencies
58+
run: |
59+
python -m pip install --upgrade pip
60+
pip install numpy scipy matplotlib sympy jupyter
61+
62+
- name: Build HTML
63+
run: quarto render --to html
64+
65+
- name: Build PDF
66+
run: quarto render --to pdf
67+
68+
- name: Copy PDF to HTML output
69+
run: |
70+
cp _book/Finite-Difference-Computing-with-PDEs.pdf _book/book.pdf
71+
72+
- name: Upload artifact
73+
uses: actions/upload-pages-artifact@v3
74+
with:
75+
path: _book
76+
77+
deploy:
78+
environment:
79+
name: github-pages
80+
url: ${{ steps.deployment.outputs.page_url }}
81+
runs-on: ubuntu-latest
82+
needs: build
83+
steps:
84+
- name: Deploy to GitHub Pages
85+
id: deployment
86+
uses: actions/deploy-pages@v4

index.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
This book teaches finite difference methods for solving partial differential equations, featuring [Devito](https://www.devitoproject.org/) for high-performance PDE solvers.
44

5+
::: {.content-visible when-format="html"}
6+
[**Download PDF version**](book.pdf){.btn .btn-primary}
7+
:::
8+
59
## About this Edition {.unnumbered}
610

711
This is an adaptation of *[Finite Difference Computing with PDEs: A Modern Software Approach](https://doi.org/10.1007/978-3-319-55456-3)* by Hans Petter Langtangen and Svein Linge (Springer, 2017). This Devito edition features:

0 commit comments

Comments
 (0)