diff --git a/.gitea/workflows/build-latex.yml b/.gitea/workflows/build-latex.yml index b8ace6b..69b8346 100644 --- a/.gitea/workflows/build-latex.yml +++ b/.gitea/workflows/build-latex.yml @@ -1,9 +1,9 @@ name: Build LaTeX PDF -on: - push: - paths: - - "**/*.tex" +# on: +# push: +# paths: +# - "**/*.tex" jobs: build: diff --git a/.gitea/workflows/build-xelatex.yml b/.gitea/workflows/build-xelatex.yml new file mode 100644 index 0000000..864978e --- /dev/null +++ b/.gitea/workflows/build-xelatex.yml @@ -0,0 +1,67 @@ +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 + + # 1. Restore the font and TeX cache from previous runs + - name: Cache TeX and Fontconfig + uses: actions/cache@v3 + with: + path: .texcache + key: texlive-fonts-${{ runner.os }} + + - name: Find all root .tex files + id: roots + run: | + ROOTS=$(grep -rl '\\documentclass' --include='*.tex' . | sed 's|^\./||' | tr '\n' ' ') + echo "roots=$ROOTS" >> "$GITHUB_OUTPUT" + echo "Root files to build: $ROOTS" + + - name: Compile all root files + if: steps.roots.outputs.roots != '' + uses: docker://texlive/texlive:latest-full + # 2. Tell the container to use the cached workspace folders + env: + TEXMFVAR: ${{ github.workspace }}/.texcache/texmf-var + XDG_CACHE_HOME: ${{ github.workspace }}/.texcache/xdg + with: + entrypoint: sh + args: >- + -c "mkdir -p pdf aux .texcache/texmf-var .texcache/xdg && for f in ${{ steps.roots.outputs.roots }}; do + echo Building $f; + latexmk -xelatex -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.roots.outputs.roots != '' + uses: actions/upload-artifact@v3 + with: + name: pdf-output + path: pdf/*.pdf + + - name: Commit PDFs back to repo + if: steps.roots.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" + + BRANCH="${GITHUB_REF#refs/heads/}" + echo "Pushing to branch: $BRANCH" + + # Ignore the .texcache folder so it doesn't get committed + git add pdf/*.pdf + git diff --cached --quiet || git commit -m "CI: rebuild all PDFs [skip ci]" + git push origin HEAD:refs/heads/"$BRANCH" \ No newline at end of file diff --git a/letteraturagiapponese.tex b/letteraturagiapponese.tex index e0ba17a..2c7fdeb 100644 --- a/letteraturagiapponese.tex +++ b/letteraturagiapponese.tex @@ -2,14 +2,14 @@ \KOMAoptions{paper=a4, fontsize=12pt, chapterprefix=true, twoside=semi, DIV=classic, parskip=half} \usepackage[svgnames, dvipsnames, table]{xcolor} -% pdflatex only -\usepackage{CJKutf8} -\usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} +% % pdflatex only +% \usepackage{CJKutf8} +% \usepackage[T1]{fontenc} +% \usepackage[utf8]{inputenc} % xelatex -% \usepackage{fontspec} -% \usepackage{xeCJK} +\usepackage{fontspec} +\usepackage{xeCJK} % JP Font \setCJKmainfont{HaranoAjiMincho-Regular} @@ -83,7 +83,8 @@ delim_0 ",\~" %% -\newcommand{\jp}[1]{\begin{CJK*}{UTF8}{min}#1\end{CJK*}} +% \newcommand{\jp}[1]{\begin{CJK*}{UTF8}{min}#1\end{CJK*}} +\newcommand{\jp}[1]{#1} \newcommand{\bul}[1]{\textbf{\underline{#1}}} \newcommand{\rarr}{$\rightarrow$} \definecolor{ForestPrimary}{HTML}{2E5339} @@ -121,8 +122,8 @@ delim_0 ",\~" \setkomafont{dictumtext}{\itshape\small} \setkomafont{dictumauthor}{\itshape\small} %% Emoji -% \newcommand{\heart}{{\fontspec{Symbola.ttf}[Path=./fonts/]\symbol{"1FA77}}} -\newcommand{\heart}{\color{pink}\faHeart} +\newcommand{\heart}{{\fontspec{Symbola.ttf}[Path=./fonts/]\symbol{"1FA77}}} +% \newcommand{\heart}{\color{pink}\faHeart} %% \title{Letteratura Giapponese I} \author{Marianna}