Skip to content

Switch to generator-latex-template #9

Switch to generator-latex-template

Switch to generator-latex-template #9

Workflow file for this run

name: Update Files
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: update-files
cancel-in-progress: true
jobs:
generatetex:
runs-on: ubuntu-latest
strategy:
matrix:
language: [en]
listings: [listings, minted]
steps:
- name: Set up Git repository
uses: actions/checkout@v4
with:
submodules: recursive
ref: '${{ github.event.pull_request.head.ref }}'
- uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache-dependency-path: 'generator-latex-template/package-lock.json'
- name: Make generator available globally
working-directory: ${{ github.workspace }}/generator-latex-template
run: |
npm install
npm link
npm install -g yo
- run: mkdir /tmp/ltg
- name: Generate template
shell: bash
working-directory: /tmp/ltg
run: |
yo $GITHUB_WORKSPACE/generator-latex-template/generators/app/index.js \
--githubpublish\
--documentclass=scientific-thesis\
--papersize=a4\
--latexcompiler=both\
--bibtextool=biblatex\
--texlive=2024\
--language=${{ matrix.language }}\
--font=default\
--listings=${{ matrix.language }}\
--cleveref=true\
--enquotes=csquotes\
--tweak_outerquote=babel\
--todo=pdfcomment\
--examples=true\
--howtotext=true
env:
yeoman_test: true
- name: Prepare files
working-directory: /tmp/ltg
run: |
ls -la
if [ ${{ matrix.language }} == "en" ]; then
LANGUAGE=english
else
LANGUAGE=german
fi
if [ ${{ matrix.listings }} == "listings" ]; then
mv main.tex main-$LANGUAGE.tex
else
mv main.tex main-$LANGUAGE-minted.tex
fi
# remove files which should not be overwritten
# the LICENSE of the repository should be kept
rm LICENSE
# latexmkrc alternates between including and excluding "--shell-escape"; we just want to keep one version of it
rm latexmkrc
# copy everything
cp -r * ${{ github.workspace }}/code/
cd ${{ github.workspace }}/code/
git status
- name: Commit changes
uses: EndBug/add-and-commit@v8
with:
message: 'Update files based on generated files by template generator'
committer_email: [email protected]
push: false
cwd: 'code'
- name: Push changes
run: |
cd code
git status
parallel --retries 10 --delay 3 ::: "git pull --rebase && git push"
publish:
runs-on: ubuntu-latest
needs: [generatetex]
steps:
- name: Set up Git repositor4
uses: actions/checkout@v4
- run: |
# use latexmkrc (which is disabled due to easy overleaf usage)
cp _latexmkrc latexmkrc
- name: Install TeX Live
uses: zauguin/install-texlive@v3
with:
package_file: '${{ github.workspace }}/Texlivefile'
- name: Prepare latexmk
run: |
updmap -sys
texhash
tlmgr generate language --rebuild-sys
- run: latexmk main-english.tex
- run: "latexmk main-english-minted.tex"
- run: "latexmk main-german.tex"
- run: "latexmk main-german-minted.tex"
- run: |
mkdir publish
cp main*.pdf publish/
cp README.md publish/
cp .github/_config.yml publish/
- uses: actions/upload-artifact@v4
with:
name: publish
path: publish/
- name: Deploy
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./publish
enable_jekyll: true