not sure how it's still finding tlmgr #30
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: Build and release | |
on: | |
push: | |
paths: | |
- 'src/*.tex' | |
- '.github/workflows/release.yaml' | |
env: | |
my_name: jonathan-zhang | |
# install here to make caching easier. most users should simply use | |
# the default installation, without setting the texdir option. | |
tex_install_path: '~/.texlive' | |
jobs: | |
build-pdf: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | |
- name: Cache tlmgr and TeX dependencies | |
id: cache-tex | |
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
path: "$tex_install_path" | |
key: tex-cache-${{ hashFiles('DEPENDS.txt') }} | |
- name: Install tlmgr | |
if: ${{ steps.tex-cache.outputs.cache-hit != 'true' }} | |
working-directory: /tmp | |
run: | | |
set -euo pipefail | |
sudo apt update && sudo apt install ca-certificates | |
wget https://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz | |
tar -xzf install-tl-unx.tar.gz | |
rm *.gz | |
cd install-tl-* | |
perl ./install-tl --no-interaction --scheme=scheme-minimal \ | |
--no-doc-install --no-src-install --paper=letter --texdir $tex_install_path | |
# Install and add to path in separate steps because of caching. If tex is | |
# cached, then the path won't be updated unless we do it in a separate | |
# step. | |
- name: Add tlmgr bin directory to path | |
run: | | |
# this directory should exist at this point, either restored from | |
# cache or installed by the previous step | |
# ls "$tex_install_path/bin/x86_64-linux" | |
echo "$tex_install_path/bin/x86_64-linux" >> $GITHUB_PATH | |
- name: Install dependencies | |
if: ${{ steps.tex-cache.outputs.cache-hit != 'true' }} | |
run: | | |
command -v tlmgr | |
tlmgr install $(cat DEPENDS.txt) | |
- name: Build PDFs | |
run: make | |
- name: Upload PDFs | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce | |
with: | |
name: "pdfs" | |
path: "build/*.pdf" | |
generate-image: | |
needs: build-pdf | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | |
- name: Download PDFs | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: "pdfs" | |
- name: Setup Python | |
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # 4.7.0 | |
with: | |
python-version: "3.11" | |
- name: Install dependencies | |
run: python -m pip install -r requirements.txt | |
- name: Create PNG | |
run: python -m pdf2png main.pdf main.png | |
- name: Upload PNG | |
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce | |
with: | |
name: "pngs" | |
path: "main.png" | |
release: | |
needs: generate-image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get timestamp and date | |
# funny timestamp format since git tags do not allow ':' | |
run: echo "timestamp=$(date +'%Y-%m-%dT%H-%MZ' --utc)" >> "$GITHUB_ENV" | |
- name: Checkout Repo | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 | |
- name: Tag this commit | |
run: | | |
git --version | |
git config user.name "GH Actions" | |
git config user.email "<>" | |
git status | |
git tag -a $timestamp -m $timestamp | |
git push origin $timestamp | |
git describe | |
- name: Download PDFs | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: "pdfs" | |
- name: Download PNGs | |
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a | |
with: | |
name: "pngs" | |
- name: Rename main.pdf to my name and current date | |
run: mv main.pdf "$my_name-$(date +'%Y-%m-%d' --utc).pdf" | |
- name: Release | |
run: | | |
gh release create --title $timestamp --generate-notes $timestamp *.pdf main.png | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |