@@ -22,27 +22,36 @@ jobs:
2222 with :
2323 python-version : " 3.12"
2424
25- - name : Install dependencies
26- run : pip install reportlab markdown beautifulsoup4 Pygments
25+ - name : Install system fonts
26+ run : |
27+ sudo apt-get update -qq
28+ sudo apt-get install -y -qq fonts-ibm-plex
29+
30+ - name : Install Python dependencies
31+ run : pip install reportlab pygments fonttools
32+
33+ - name : Convert Inter fonts (OTF → TTF for ReportLab)
34+ run : python scripts/convert_fonts.py
2735
2836 - name : Get short commit hash
2937 id : vars
3038 run : echo "short_sha=$(git rev-parse --short=6 HEAD)" >> "$GITHUB_OUTPUT"
3139
32- - name : Build PDF
33- run : python scripts/build_pdf.py "gitbyexample-${{ steps.vars.outputs.short_sha }}.pdf"
40+ - name : Build both PDFs
41+ run : python scripts/build_pdf.py "gitbyexample-${{ steps.vars.outputs.short_sha }}" --both
3442
3543 - name : Publish to pdf branch
3644 run : |
37- PDF_FILE="gitbyexample-${{ steps.vars.outputs.short_sha }}.pdf"
45+ SHORT="${{ steps.vars.outputs.short_sha }}"
46+ LIGHT="gitbyexample-${SHORT}-light.pdf"
47+ DARK="gitbyexample-${SHORT}-dark.pdf"
3848
39- # Save the PDF outside the working tree
40- cp "$PDF_FILE " /tmp/"$PDF_FILE"
49+ cp "$LIGHT" /tmp/
50+ cp "$DARK " /tmp/
4151
4252 git config user.name "github-actions[bot]"
4353 git config user.email "github-actions[bot]@users.noreply.github.com"
4454
45- # Switch to pdf branch (fetch existing or create orphan)
4655 if git ls-remote --heads origin pdf | grep -q pdf; then
4756 git fetch origin pdf
4857 git checkout pdf
@@ -52,23 +61,23 @@ jobs:
5261 git clean -fd
5362 fi
5463
55- # Copy the new PDF in
56- cp /tmp/"$PDF_FILE " .
64+ cp /tmp/"$LIGHT" .
65+ cp /tmp/"$DARK " .
5766
58- # Clean old PDFs, keep last 10
59- ls -t gitbyexample-*.pdf 2>/dev/null | tail -n +11 | xargs -r rm -f
67+ ls -t gitbyexample-*-light.pdf 2>/dev/null | tail -n +11 | xargs -r rm -f
68+ ls -t gitbyexample-*-dark .pdf 2>/dev/null | tail -n +11 | xargs -r rm -f
6069
61- # Write README for the pdf branch
6270 cat > README.md << 'EOF'
63- # Git By Example — PDF Builds
71+ # Git By Example — PDF Builds
6472
65- This branch contains auto-generated PDF builds of the book.
73+ This branch contains auto-generated PDF builds of the book.
6674
67- Each push to `main` produces a new PDF named `gitbyexample-<commit>.pdf`.
75+ Each push to `main` produces two PDFs :
76+ - ` gitbyexample-<commit>-light.pdf` — Light edition
77+ - ` gitbyexample-<commit>-dark.pdf` — Dark edition
6878
69- 📥 **Download the latest**: check the most recent file below.
70- EOF
71- sed -i 's/^ //' README.md
79+ 📥 **Download the latest** : check the most recent files below.
80+ EOF
7281
7382 git add README.md gitbyexample-*.pdf
7483 git commit -m "pdf : build from ${GITHUB_SHA::6}" || echo "No changes to commit"
0 commit comments