mirror of
https://github.com/NotXia/unibo-ai-notes.git
synced 2025-12-15 02:52:22 +01:00
62 lines
1.7 KiB
YAML
62 lines
1.7 KiB
YAML
name: Compile LaTeX
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths: ["src/**", .github/workflows/**]
|
|
|
|
jobs:
|
|
compile:
|
|
name: Compile notes
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Install LaTeX
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y latexmk texlive texlive-science texlive-latex-extra
|
|
|
|
- name: Compile
|
|
run: |
|
|
mkdir /tmp/compiled
|
|
|
|
cp README.md /tmp/compiled
|
|
cp LICENSE /tmp/compiled
|
|
|
|
shopt -s globstar
|
|
cd src
|
|
work_dir=$(pwd)
|
|
for f in **/[!_]*.tex; do
|
|
f_dir=$(dirname $f)
|
|
f_base=$(basename $f)
|
|
f_nameonly="${f_base%.*}"
|
|
|
|
cd ${f_dir};
|
|
|
|
# Insert last update date
|
|
last_update=$(git log -1 --pretty="format:%ad" --date="format:%d %B %Y" .)
|
|
cp --remove-destination $(readlink ainotes.cls) ainotes.cls
|
|
sed -i "s/PLACEHOLDER-LAST-UPDATE/${last_update}/" ainotes.cls
|
|
|
|
latexmk -pdf -jobname=${f_nameonly} ${f_base}
|
|
mkdir -p /tmp/compiled/${f_dir}
|
|
mv ${f_nameonly}.pdf /tmp/compiled/${f_dir}/.
|
|
cd $work_dir
|
|
done
|
|
|
|
- name: Move to pdfs branch
|
|
uses: s0/git-publish-subdir-action@develop
|
|
env:
|
|
REPO: self
|
|
BRANCH: pdfs
|
|
FOLDER: /tmp/compiled
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
COMMIT_NAME: "github-actions[bot]"
|
|
COMMIT_EMAIL: "github-actions[bot]@users.noreply.github.com"
|
|
MESSAGE: "🤖 Hello human, doing my things ({sha})" |