chore: 🔀 Merge changes from template #119
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Automated Build | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
# The branches below must be a subset of the branches above | |
branches: [ main ] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-22.04 | |
container: | |
image: sagemath/sagemath:latest | |
options: --user root | |
env: | |
TEXMFDIR: /usr/local/texlive | |
steps: | |
- name: Install tools and dependencies | |
run: | | |
apt-get update -y | |
apt-get install -y wget curl git jq inkscape ghostscript imagemagick perl ruby pandoc ffmpeg | |
- name: Install basic TeXLive scheme | |
run: | | |
mkdir install-tl && cd install-tl | |
wget -O - -- http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz | tar xzf - --strip-components=1 | |
./install-tl --texdir "$TEXMFDIR" --no-doc-install --no-src-install --no-interaction --scheme scheme-basic | |
echo "$TEXMFDIR/bin/x86_64-linux/" >> $GITHUB_PATH | |
- name: Add supplementary TeXLive repository | |
run: | | |
tlmgr repository add https://mirror.ctan.org/systems/texlive/tlcontrib tlcontrib | |
tlmgr pinning add tlcontrib "*" | |
- name: Generate TeXLive cache key | |
run: | | |
echo "TEXCACHEKEY=texlive$(tlmgr --version | sed -n -e 's/^.* version //p')-cache" >> $GITHUB_ENV | |
- name: Restore TeXLive packages from cache | |
id: cache-tl-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.TEXMFDIR }} | |
key: ${{ env.TEXCACHEKEY }} | |
- name: Import restored TeXLive packages | |
if: ${{ steps.cache-tl-restore.outputs.cache-hit == 'true' }} | |
run: | | |
mktexlsr | |
texhash | |
updmap-sys --force | |
fmtutil-sys --all | |
tlmgr recreate-tlpdb | |
tlmgr update --self --all | |
- name: Install full TeXLive scheme | |
if: ${{ steps.cache-tl-restore.outputs.cache-hit != 'true' }} | |
run: tlmgr install scheme-full | |
- name: Install supplementary TeXLive packages | |
if: ${{ steps.cache-tl-restore.outputs.cache-hit != 'true' }} | |
run: tlmgr install collection-contrib | |
- name: Save TeXLive packages to cache | |
if: ${{ steps.cache-tl-restore.outputs.cache-hit != 'true' }} | |
uses: actions/cache/save@v3 | |
with: | |
path: ${{ env.TEXMFDIR }} | |
key: ${{ env.TEXCACHEKEY }} | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Declares the repository safe and not under dubious ownership. | |
- name: Add repository to git safe directories | |
run: git config --global --add safe.directory $GITHUB_WORKSPACE | |
- name: Build document | |
run: | | |
find src -type d -links 2 -exec mkdir -p "out/{}" \; | |
cp "$(find / -name "sagetex.sty" -print -quit)" ./ | |
latexmk -g -f --interaction=nonstopmode | |
cp out/main.pdf out/${{ github.event.repository.name }}.pdf | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: LaTeX-Output | |
path: out/ | |
- name: Check release tag | |
id: check_tag | |
if: github.event_name != 'pull_request' | |
run: echo "build_tag=$(git tag -l build)" >> $GITHUB_OUTPUT | |
- name: Release artifacts | |
uses: softprops/action-gh-release@v1 | |
if: ${{ steps.check_tag.outputs.build_tag == 'build' }} | |
with: | |
tag_name: build | |
files: out/${{ github.event.repository.name }}.pdf |