Skip to content

* .github/workflows/test-and-deploy.yml: Use TinyTeX. #266

* .github/workflows/test-and-deploy.yml: Use TinyTeX.

* .github/workflows/test-and-deploy.yml: Use TinyTeX. #266

Workflow file for this run

name: CI
on:
push:
paths-ignore: ['README.md','bibpool/**','**precommit','setup_worktree.sh','mklog','**.latexmkrc','.gitignore']
pull_request:
paths-ignore: ['README.md','bibpool/**','**precommit','setup_worktree.sh','mklog','**.latexmkrc','.gitignore']
env:
cache-version: v1
jobs:
ci:
if: "! contains(github.event.head_commit.message, '[skip ci]')"
concurrency: ci-${{ github.ref }} # Recommended if you intend to make multiple deployments in quick succession.
runs-on: ubuntu-latest
steps:
- run: echo "πŸŽ‰ The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
- run: echo "πŸ”Ž The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: πŸ’‘ Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: "πŸ’‘ List files in the repository."
run: |
ls -R ${{ github.workspace }}
- name: Maybe skip before install
env:
PR_COMMIT_RANGE: ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
PUSH_COMMIT_RANGE: ${{ github.event.before }}..${{ github.event.after }}
run: |
set +e
INCLUDE_ONLY="\.bib\|\.tex\|optbib2html\|deploy\|actions"
if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then
export TRAVIS_COMMIT_RANGE=${PR_COMMIT_RANGE}
else
echo "This is a branch build"
export TRAVIS_COMMIT_RANGE=${PUSH_COMMIT_RANGE}
fi
echo "Emulated TRAVIS_COMMIT_RANGE: ${TRAVIS_COMMIT_RANGE}"
# Use -m so that merge commits are also considered
git log --oneline --graph ${TRAVIS_COMMIT_RANGE}
if [ $? -eq 0 ]; then
FILES_CHANGED=$(git diff --raw -c --no-commit-id --name-only ${TRAVIS_COMMIT_RANGE} | grep -e ${INCLUDE_ONLY} || true)
echo "Files changed: $FILES_CHANGED"
else
FILES_CHANGED=0
fi
echo "FILES_CHANGED=${#FILES_CHANGED}" >> $GITHUB_ENV # get the char len of diff output (used later)
- name: Cache TinyTeX
if: ${{ env.FILES_CHANGED != 0 }}
id: cache-tinytex
uses: actions/cache@v3
with:
path: $HOME/.TinyTeX
key: ${{ env.cache-version }}-${{ runner.os }}-tinytex-essential
restore-keys: ${{ env.cache-version }}-${{ runner.os }}-tinytex-essential
- name: Install packages
if: ${{ env.FILES_CHANGED != 0 }}
run: |
sudo apt -y update
sudo apt -y install bibtex2html tidy ghostscript qpdf
- uses: r-lib/actions/setup-tinytex@v2-branch
if: ${{ env.FILES_CHANGED != 0 && steps.cache-tinytex.outputs.cache-hit != 'true'}}
env:
TINYTEX_INSTALLER: TinyTeX-1
TINYTEX_VERSION: 2023.09
- name: Install additional LaTeX packages
if: ${{ env.FILES_CHANGED != 0 && steps.cache-tinytex.outputs.cache-hit != 'true'}}
run: |
texlive_packages=./.github/texlive_packages
echo "Updating TexLive"
# Keep no backups (not required, simply makes cache bigger)
tlmgr option -- autobackup 0
echo "Updating tlmgr itself"
tlmgr update --self
echo "Install ${texlive_packages}"
tlmgr install $(sed 's/\s*#.*//;/^\s*$/d' "${texlive_packages}")
tlmgr path add
- name: Run test
if: ${{ success() && env.FILES_CHANGED != 0 }}
run: cd test && ./test.sh
- name: Compress PDFs
if: ${{ success() && env.FILES_CHANGED != 0 }}
run: cd test && ./compress.sh testbib.pdf testshortbib.pdf && mv --force -t ../web/ testbib.pdf testshortbib.pdf
- name: Linter 🧹
if: ${{ success() && env.FILES_CHANGED != 0 && github.event_name == 'push' }}
run: |
./scripts/linter *.bib && exit 0
git config --local user.name "${GITHUB_ACTOR}"
git config --local user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git add *.bib
(git commit -m "Linter '.bib' files [skip ci]" && git pull --rebase && git push origin) || echo "No changes to commit"
- name: optbib2html
if: ${{ success() && env.FILES_CHANGED != 0 }}
run: ./scripts/optbib2html.sh
- name: Deploy πŸš€
if: ${{ success() && env.FILES_CHANGED != 0 && github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: web # The folder the action should deploy.
clean: false
- run: echo "🍏 This job's status is ${{ job.status }}."