-
Notifications
You must be signed in to change notification settings - Fork 55
46 lines (37 loc) · 2.01 KB
/
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
name: Book
on: [push]
jobs:
book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: sudo apt update && sudo apt install -y pandoc texlive-latex-base texlive-latex-extra texlive-latex-recommended texlive-luatex fonts-dejavu python3-pygments
- name: Download the Book Template
run: |
curl -L https://github.com/Wandmalfarbe/pandoc-latex-template/releases/download/v2.0.0/Eisvogel.tar.gz | tar -xz eisvogel.latex
- name: Build Some LaTeX
run: |
pandoc --to latex md/cover.md $(grep -o '\(md/.*\.md\)' README.md | tr -d '(' | tr -d ')') --toc --template ./eisvogel.latex --top-level-division=chapter -V documentclass=book -V classoption=oneside --no-highlight |
sed -e 's/\\begin{verbatim}/\\begin{minted}{Lean}/' -e 's/{verbatim}/{minted}/' -e's/% Listings/\\usepackage{minted}\n\\newmintinline[lean]{pygments\/lean4.py:Lean4Lexer -x}{bgcolor=white}\n\\newminted[leancode]{pygments\/lean4.py:Lean4Lexer -x}{fontsize=\\footnotesize}\n\\setminted{fontsize=\\footnotesize, breaklines}\n/' >out.tex
- name: Build a PDF
# Running twice appears to be necessary to not get a blank TOC?!
run: lualatex -shell-escape out.tex && lualatex -shell-escape out.tex
- name: Rename
# Minted doesn't like filenames with spaces in them unfortunately, so we mv.
run: mv out.tex 'Metaprogramming in Lean 4.tex' && mv out.pdf 'Metaprogramming in Lean 4.pdf'
- name: Upload PDF to artifact storage
if: github.ref != 'refs/heads/master'
uses: actions/upload-artifact@v3
with:
name: "Metaprogramming in Lean 4"
path: "Metaprogramming in Lean 4.pdf"
- uses: "marvinpinto/action-automatic-releases@latest"
if: github.ref == 'refs/heads/master'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
title: "Metaprogramming in Lean 4"
files: |
Metaprogramming in Lean 4.tex
Metaprogramming in Lean 4.pdf