-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (83 loc) · 2.47 KB
/
render.yml
File metadata and controls
98 lines (83 loc) · 2.47 KB
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
96
97
98
name: Build LaTeX PDFs
on:
push:
branches: [main]
permissions:
contents: write
jobs:
build-pdfs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache APT packages
uses: actions/cache@v4
with:
path: |
/var/cache/apt/archives
/var/lib/apt/lists
key: ${{ runner.os }}-apt-${{ hashFiles('.github/workflows/render.yml') }}
restore-keys: |
${{ runner.os }}-apt-
- name: Install TeX Live
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
texlive-latex-base \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-recommended \
texlive-fonts-extra \
texlive-bibtex-extra \
texlive-xetex \
biber
- name: Build PDFs from .tex files
shell: bash
run: |
set -euo pipefail
mapfile -d '' TEXFILES < <(find . -maxdepth 1 -type f -name "*.tex" -print0)
if [[ "${#TEXFILES[@]}" -eq 0 ]]; then
echo "No .tex files found at repo root; skipping."
exit 0
fi
for tex in "${TEXFILES[@]}"; do
echo "==> Building: $tex"
xelatex -shell-escape "$tex"
# Run xelatex a second time to resolve references and create the TOC correctly
xelatex -shell-escape "$tex"
done
echo "Built PDFs:"
ls -la *.pdf
- name: Upload PDFs as artifacts
uses: actions/upload-artifact@v4
with:
name: latex-pdfs
path: "*.pdf"
if-no-files-found: error
retention-days: 14
release:
runs-on: ubuntu-latest
needs: build-pdfs
steps:
- name: Download PDFs
uses: actions/download-artifact@v4
with:
name: latex-pdfs
- name: Prepare release files
run: |
mkdir -p release
for pdf in *.pdf; do
if [[ ! "$pdf" =~ ^T0 ]]; then
cp "$pdf" release/
fi
done
ls -la release/
- name: Create or Update Release
uses: softprops/action-gh-release@v1
with:
tag_name: latest
name: Course slides
body: "Automatic release with the latest changes from the `main` branch"
files: release/*.pdf
draft: false
prerelease: false