Skip to content

Merge pull request #50 from peng8wang/main #199

Merge pull request #50 from peng8wang/main

Merge pull request #50 from peng8wang/main #199

Workflow file for this run

name: Build and deploy book site to GitHub Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- lang: en
tex_file: book-main.tex
artifact: build-en
- lang: zh
tex_file: book-main_zh.tex
artifact: build-zh
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Build PDF and HTML
uses: xu-cheng/texlive-action@475ab07999e9709e524c3708488c8c170d3a6611
with:
docker_image: ghcr.io/xu-cheng/texlive-debian@sha256:394f96c67d6c0db340897848a34c99391e7be469d05f24f6ba1430173d1323f5
run: |
export DEBIAN_FRONTEND=noninteractive
export DEBIAN_SNAPSHOT=20260306T000000Z
export CURL_VERSION=8.14.1-2+deb13u2
export IMAGEMAGICK_VERSION=8:7.1.1.43+dfsg1-1+deb13u5
export RSYNC_VERSION=3.4.1+ds1-5+deb13u1
export UV_VERSION=0.9.7
cat >/etc/apt/sources.list.d/debian.sources <<EOF
Types: deb
URIs: https://snapshot.debian.org/archive/debian/${DEBIAN_SNAPSHOT}
Suites: trixie trixie-updates
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
Types: deb
URIs: https://snapshot.debian.org/archive/debian-security/${DEBIAN_SNAPSHOT}
Suites: trixie-security
Components: main
Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg
EOF
echo 'Acquire::Check-Valid-Until "false";' >/etc/apt/apt.conf.d/99snapshot
apt-get update -y
apt-get install -y \
curl=${CURL_VERSION} \
imagemagick=${IMAGEMAGICK_VERSION} \
rsync=${RSYNC_VERSION}
curl -LsSf https://astral.sh/uv/${UV_VERSION}/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
echo "tlmgr:"
tlmgr --version | sed -n '1,3p'
echo
echo "xelatex:"
xelatex --version | sed -n '1,3p'
echo
echo "latexmk:"
latexmk -v | sed -n '1,2p'
echo
echo "biber:"
biber --version | sed -n '1,2p'
echo
echo "make4ht:"
make4ht --version | sed -n '1,2p'
echo
echo "kpsewhich:"
kpsewhich --version | sed -n '1,3p'
echo
echo "ImageMagick:"
convert -version | sed -n '1,2p'
echo
echo "curl:"
curl --version | sed -n '1p'
echo
echo "rsync:"
rsync --version | sed -n '1p'
echo
echo "uv:"
uv --version
# XeTeX bakes main_memory into xelatex.fmt at format-build time;
# extra_mem_bot in texmf.cnf is ignored at runtime. The default
# (~261M words) is barely enough for the English book under tex4ht
# and too small for the Chinese book (ctex + tex4ht). Rebuild a
# user-level format using the larger main_memory in repo texmf.cnf.
# This must run BEFORE the build sequences to avoid race conditions.
export TEXMFCNF="$PWD:"
fmtutil-user --byfmt xelatex
bash website/latex_to_html/build.sh ${{ matrix.tex_file }} _output
- name: Upload build output
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact }}
path: _output/
retention-days: 1
deploy:
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
sparse-checkout: website/html
- name: Download English build
uses: actions/download-artifact@v4
with:
name: build-en
path: website/html/
- name: Download Chinese build
uses: actions/download-artifact@v4
with:
name: build-zh
path: website/html/zh/
- name: Move PDFs to shared assets directory
run: |
mkdir -p website/html/assets
[ -f website/html/book-main.pdf ] && mv website/html/book-main.pdf website/html/assets/book-main.pdf
[ -f website/html/zh/book-main_zh.pdf ] && mv website/html/zh/book-main_zh.pdf website/html/assets/book-main_zh.pdf
- name: Configure Pages
uses: actions/configure-pages@v5
- name: Upload site artifact
uses: actions/upload-pages-artifact@v3
with:
path: website/html
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4