Generate PDFs with Forgejo Actions and Typst
I wanted to enforce PDF/A-4 archival
format of PDF when using Typst to
generate them. The tinymist language
server does not seem to support
the selection of the standard when automatically exporting the PDFs.
The Action below will try to compile all PDFs with this standard and will fail if it’s unable to compile.
In addition, this action use upload-artifact to generate an archive with
the rendered PDFs in the Action itself without polluting the Git history.
Otherwise, your repo will grow really fast because at every recompilation,
the PDFs change the ModifyDate, and since they are binary, forces Git
to re-commit the new version in its full size.
This way, you get 7 days of compiled PDFs that you can download.
name: Render pdfs
on:
push:
jobs:
render-pdfs:
runs-on: debian-latest
steps:
- uses: actions/checkout@v6
- name: Setup Typst
uses: https://github.com/typst-community/setup-typst@v5
- name: Compile PDFs
run: for f in *.typ; do typst compile --pdf-standard a-4 "$f"; done
- name: Upload generated PDFs
uses: actions/upload-artifact@v3
with:
name: compiled-pdfs
path: "**/*.pdf"
retention-days: 7