English | 简体ä¸ć–‡
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@v4
- 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@v4
with:
cache-dependency-path: requirements.typ
# Now Typst is installed and packages will be cached!
- run: typst compile paper.typ paper.pdf
typst-version
: Version range or exact version of Typst to use, using SemVer's version range syntax. Uses the latest version if unset.allow-prereleases
: Whentrue
, a version range includinglatest
passed totypst-version
input will match prerelease versions.cache-dependency-path
: Used to specify the path to dependency file. Supports a Typst file with lines ofimport
keyword.token
: The token used to authenticate when fetching Typst distributions from typst/typst. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
typst-version
: The installed Typst version. Useful when given a version range as input.cache-hit
: A boolean value to indicate a cache entry was found.
- uses: typst-community/setup-typst@v4
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@v4
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 Pull Request and some magic GitHub Actions will run to test the action.