GitHub Action
Setup Typst
v3.1.0
Latest version
This action provides the following functionality for GitHub Actions users:
- Installing a version of Typst and adding it to the PATH
- Optionally caching packages dependencies
- uses: typst-community/setup-typst@v3
- run: typst compile paper.typ paper.pdf |
name: Render paper.pdf
on: push
jobs:
render-paper:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: typst-community/setup-typst@v3
with:
cache-dependency-path: requirements.typ
# Now Typst is installed and packages will be cached!
- run: typst compile paper.typ paper.pdf
typst-token
: The GitHub token to use when pulling versions from typst/typst. By default this should cover all cases. You shouldn't have to touch this setting.typst-version
: The version of Typst to install. This can be an exact version like0.10.0
or a semver range like0.10
or0.x
. You can also specifylatest
to always use the latest version. The default islatest
.cache-dependency-path
: Used to specify the path to dependency file. Supports a Typst file with lines ofimport
keyword.
typst-version
: The version of Typst that was installed. This will be something like0.10.0
or similar.cache-hit
: Whether or not Typst was restored from the runner's cache or download anew.
- uses: typst-community/setup-typst@v3
with:
cache-dependency-path: requirements.typ
- run: typst compile paper.typ paper.pdf
- uses: actions/upload-artifact@v4
with:
name: paper
path: paper.pdf
If your tasks require extending beyond the set of fonts in GitHub Actions runner, you can employ the Fontist to facilitate custom font installations. Here's an example showcasing how to use [fontist/setup-fontist] to add new fonts:
- uses: fontist/setup-fontist@v2
- run: fontist install "Fira Code"
- uses: typst-community/setup-typst@v3
with:
cache-dependency-path: requirements.typ
- run: typst compile paper.typ paper.pdf --font-path ~/.fontist/fonts
How do I test my changes?
Open a draft Pull Request and some magic GitHub Actions will run to test the action.