ensures that all \include{} or \input{} paths (which are relative to main.tex) resolve correctly
70 lines
1.8 KiB
YAML
70 lines
1.8 KiB
YAML
name: LaTeX Diff
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
base_branch:
|
|
description: 'Base branch (older version)'
|
|
required: true
|
|
default: 'main'
|
|
compare_branch:
|
|
description: 'Compare branch (new version)'
|
|
required: true
|
|
default: 'dev'
|
|
|
|
jobs:
|
|
latexdiff:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: ghcr.io/xu-cheng/texlive-full:latest
|
|
options: --user root
|
|
|
|
steps:
|
|
- name: Checkout base branch
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.inputs.base_branch }}
|
|
path: base
|
|
|
|
- name: Checkout compare branch
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.inputs.compare_branch }}
|
|
path: compare
|
|
|
|
- name: Install flatex (in a virtualenv)
|
|
run: |
|
|
python3 -m venv /tmp/latex-venv
|
|
. /tmp/latex-venv/bin/activate
|
|
pip install flatex
|
|
ln -s /tmp/latex-venv/bin/flatex /usr/local/bin/flatex
|
|
|
|
- name: Create output folder
|
|
run: mkdir -p diff_output
|
|
|
|
- name: Flatten base/main.tex
|
|
run: |
|
|
cd base/latex
|
|
flatex main.tex > ../../../diff_output/base_flat.tex
|
|
|
|
- name: Flatten compare/main.tex
|
|
run: |
|
|
cd compare/latex
|
|
flatex main.tex > ../../../diff_output/compare_flat.tex
|
|
|
|
- name: Generate diff.tex using latexdiff
|
|
run: |
|
|
latexdiff diff_output/base_flat.tex diff_output/compare_flat.tex > diff_output/diff.tex
|
|
|
|
- name: Compile diff.tex to PDF
|
|
working-directory: diff_output
|
|
run: |
|
|
xelatex -interaction=nonstopmode diff.tex
|
|
xelatex -interaction=nonstopmode diff.tex
|
|
|
|
- name: Upload diff output files
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: latex-diff-output
|
|
path: diff_output/
|