diff --git a/.gitea/workflows/build-pdf.yml b/.gitea/workflows/build-pdf.yml new file mode 100644 index 0000000..6fb0293 --- /dev/null +++ b/.gitea/workflows/build-pdf.yml @@ -0,0 +1,63 @@ +name: Build LaTeX PDF + +on: + push: + paths: + - '**/*.tex' + +jobs: + build: + runs-on: ubuntu-latest + env: + GIT_SSL_NO_VERIFY: "true" + NODE_EXTRA_CA_CERTS: /usr/local/share/ca-certificates/Egregge.crt + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 2 # need previous commit to diff against + + - name: Find changed .tex root files + id: changed + run: | + apt-get update -qq && apt-get install -y -qq git > /dev/null + git config --global --add safe.directory "$GITHUB_WORKSPACE" + + # root files = .tex files that contain \documentclass + CHANGED=$(git diff --name-only "${{ github.event.before }}" "${{ github.sha }}" -- '*.tex' || true) + ROOTS="" + for f in $CHANGED; do + if [ -f "$f" ] && grep -q '\\documentclass' "$f"; then + ROOTS="$ROOTS $f" + fi + done + echo "roots=$ROOTS" >> "$GITHUB_OUTPUT" + echo "Root files to build: $ROOTS" + + - name: Compile changed root files + if: steps.changed.outputs.roots != '' + uses: docker://texlive/texlive:latest-full + with: + entrypoint: sh + args: >- + -c "mkdir -p pdf aux && for f in ${{ steps.changed.outputs.roots }}; do + echo Building $f; + latexmk -pdf -interaction=nonstopmode -halt-on-error -outdir=pdf -auxdir=aux \"$f\" || exit 1; + done && find pdf -type f ! -name '*.pdf' -delete" + + - name: Upload built PDFs + if: steps.changed.outputs.roots != '' + uses: actions/upload-artifact@v3 + with: + name: pdf-output + path: pdf/*.pdf + + - name: Commit PDFs back to repo + if: steps.changed.outputs.roots != '' + run: | + git config user.name "gitea-actions" + git config user.email "actions@gitea.local" + git remote set-url origin "https://Domipoke:${{ secrets.GITEA_PUSH_TOKEN }}@gitea.egregge.eg/Domipoke/SharedLaTeX.git" + git add pdf/*.pdf + git diff --cached --quiet || git commit -m "CI: rebuild PDF(s) [skip ci]" + git push origin HEAD:${{ github.ref_name }} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8087664 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +./aux +./aux/* \ No newline at end of file diff --git a/letteraturagiapponese.tex b/letteraturagiapponese.tex index 945b5fc..c3df9e3 100644 --- a/letteraturagiapponese.tex +++ b/letteraturagiapponese.tex @@ -3,7 +3,7 @@ \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{microtype} - +% try 2 \newcommand{\jp}[1]{\begin{CJK*}{UTF8}{min} #1 \end{CJK*}}