From f3760e87e75898416db8988f933de517bc033f0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Deividas=20Bur=C5=A1kaitis?= Date: Tue, 14 Jan 2025 15:18:31 +0200 Subject: [PATCH] Possible solution to set the correct version in the PDF footer when building with GH Actions (#836) --- .gitignore | 3 +++ build.books.sh | 6 ++++++ meta.tex => meta.tmpl.tex | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) rename meta.tex => meta.tmpl.tex (93%) diff --git a/.gitignore b/.gitignore index c93ff36a9..a07b6ed06 100644 --- a/.gitignore +++ b/.gitignore @@ -9,5 +9,8 @@ _book/ *.mobi *.pdf +# templated files +meta.tex + game.db.json .DS_Store diff --git a/build.books.sh b/build.books.sh index 141a13f55..02a2b8621 100755 --- a/build.books.sh +++ b/build.books.sh @@ -2,6 +2,12 @@ set -e +if [ -v GITHUB_REF_NAME ]; then + sed "s/%%FOOTER_VERSION%%/${GITHUB_REF_NAME}/" meta.tmpl.tex > meta.tex +else + sed "s/%%FOOTER_VERSION%%/UNDEFINED VERSION/" meta.tmpl.tex > meta.tex +fi + docker run --rm -v `pwd`:/data uppalabharath/pandoc-latex-cjk:latest --from=gfm+rebase_relative_paths -o learn-go-with-tests.pdf \ -H meta.tex --pdf-engine=xelatex --variable urlcolor=blue --toc --toc-depth=1 \ -B pdf-cover.tex \ diff --git a/meta.tex b/meta.tmpl.tex similarity index 93% rename from meta.tex rename to meta.tmpl.tex index 8cd33510e..738a1695e 100644 --- a/meta.tex +++ b/meta.tmpl.tex @@ -11,4 +11,4 @@ \pagestyle{fancy} \fancyhf{} -\cfoot{v 10.0.0} +\cfoot{%%FOOTER_VERSION%%}