From f26d5525330d41a34e2f3f9d06ea024d8883ff3e Mon Sep 17 00:00:00 2001 From: NotXia <35894453+NotXia@users.noreply.github.com> Date: Fri, 13 Oct 2023 08:57:45 +0200 Subject: [PATCH] Add last update in title page --- .github/workflows/compile.yml | 18 +++++++++++++----- src/ainotes.cls | 3 ++- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index e1d8e75..efa224f 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -14,6 +14,8 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Install LaTeX run: | @@ -31,15 +33,21 @@ jobs: cd src work_dir=$(pwd) for f in **/[!_]*.tex; do - f_dir=$(dirname $f); - f_base=$(basename $f); - f_nameonly="${f_base%.*}"; + f_dir=$(dirname $f) + f_base=$(basename $f) + f_nameonly="${f_base%.*}" cd ${f_dir}; - latexmk -pdf -jobname=${f_nameonly} ${f_base}; + + # 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; + cd $work_dir done - name: Move to pdfs branch diff --git a/src/ainotes.cls b/src/ainotes.cls index 6c4f126..7dbf32f 100644 --- a/src/ainotes.cls +++ b/src/ainotes.cls @@ -75,7 +75,8 @@ \centering \vspace*{\fill} \huge - \textbf{\@title} + \textbf{\@title}\\ + {\Large Last update: {PLACEHOLDER-LAST-UPDATE}} \vspace*{\fill} \Large