Skip to content

Update checkout action #172

Update checkout action

Update checkout action #172

Workflow file for this run

name: Update Files
on:
push:
workflow_dispatch:
concurrency:
group: update-files
cancel-in-progress: true
jobs:
generatetex:
runs-on: ubuntu-latest
strategy:
matrix:
language: [en, de]
font: [default, times]
listings: [listings, minted]
enquotes: [csquotes]
tweak_outerquote: [babel]
todo: [pdfcomment]
examples: [true]
steps:
- name: Set up Git repository
uses: actions/checkout@v3
with:
submodules: recursive
path: 'code'
- uses: actions/setup-node@v3
- name: Update npm
run: npm i -g npm@latest
- run: npm i npm@latest
- name: Make generator available globally
working-directory: ${{ github.workspace }}/code/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 latex-template\
--githubpublish\
--docker=reitzig\
--documentclass=lncs\
--papersize=a4\
--latexcompiler=pdflatex\
--bibtextool=bibtex\
--overleaf=true\
--texlive=2022\
--lang=${{ matrix.language }}\
--font=${{ matrix.font }}\
--listings=${{ matrix.listings }}\
--enquotes=${{ matrix.enquotes }}\
--tweakouterquote=${{ matrix.tweak_outerquote }}\
--todo=${{ matrix.todo }}\
--examples=${{ matrix.examples }}\
--howtotext=false
env:
yeoman_test: true
- name: Prepare files
working-directory: /tmp/ltg
run: |
ls -la
cp paper.tex paper-${{ matrix.language }}-${{ matrix.font }}-${{ matrix.listings }}.tex
if [ "paper-${{ matrix.language }}-${{ matrix.font }}-${{ matrix.listings }}.tex" != "paper-en-default-listings.tex" ]; then
# keep paper.tex only for English, default font, listings, cleveref
rm paper.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/
# output current status
cd ${{ github.workspace }}/code/
git status
git diff
- 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 9 ::: "git status && git pull --rebase && git push"
publish:
runs-on: ubuntu-latest
needs: [generatetex]
services:
registry:
image: registry:2
ports:
- 5000:5000
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver-opts: network=host
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx
- name: Build Docker image
uses: docker/build-push-action@v4
with:
push: true
provenance: false
tags: localhost:5000/name/app:latest
- name: Set up Git repository
uses: actions/checkout@v3
- run: |
cp paper-en-default-listings.tex paper.tex
cp paper-en-default-minted.tex paper-minted.tex
cp paper-en-times-listings.tex paper-newtx.tex
cp paper-en-times-minted.tex paper-minted-newtx.tex
mkdir /tmp/out
# use latexmkrc (which is disabled due to easy overleaf usage)
cp _latexmkrc latexmkrc
- name: Build paper.tex
run: docker run -v $(pwd):/work/src -v /tmp/out:/work/out localhost:5000/name/app:latest work "latexmk paper.tex"
- name: Build paper-minted.tex
run: docker run -v $(pwd):/work/src -v /tmp/out:/work/out localhost:5000/name/app:latest work "latexmk paper-minted.tex"
- name: Build paper-newtx.tex
run: docker run -v $(pwd):/work/src -v /tmp/out:/work/out localhost:5000/name/app:latest work "latexmk paper-newtx.tex"
- name: Build paper-minted-newtx.tex
run: docker run -v $(pwd):/work/src -v /tmp/out:/work/out localhost:5000/name/app:latest work "latexmk paper-minted-newtx.tex"
- run: |
mkdir publish
cp /tmp/out/*.pdf publish/
cp paper.tex publish/
cp README.md publish/
cp .github/_config.yml publish/
- uses: actions/upload-artifact@v2
with:
name: publish
path: publish/
- name: Deploy
if: github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./publish
enable_jekyll: true
force_orphan: true
user_name: 'github-actions[bot]'
user_email: 'github-actions[bot]@users.noreply.github.com'