Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache Typst packages #16

Merged
merged 9 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,7 @@ jobs:
- run: npm ci
- run: npm run build
- uses: ./
with:
packages-id: 1
- run: typst --version
- run: typst compile test.typ
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2023 yusancky
Copyright (c) 2023-2024 yusancky

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
36 changes: 22 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</table>

📝 Installs [Typst] for GitHub Actions \
⚡ Caches installation files
⚡ Caches installation files and packages
yusancky marked this conversation as resolved.
Show resolved Hide resolved

## Usage

Expand All @@ -28,7 +28,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: typst-community/setup-typst@v3
# Now Typst is installed!
with:
packages-id: 1
# Now Typst and packages group 1 is installed!
- run: typst compile paper.typ paper.pdf
- uses: actions/upload-artifact@v4
with:
Expand All @@ -38,30 +40,36 @@ jobs:

### Inputs

- **`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-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 like `0.10.0` or a semver range like
`0.10` or `0.x`. You can also specify `latest` to always use
the latest version. The default is `latest`.

- **`typst-version`:** Which version of `typst` to install. This can be an exact
version like `0.10.0` or a semver range like `0.10` or `0.x`. You can also
specify `latest` to always use the latest version. The default is `latest`.
- **`packages-id`:** The identifier of a group of packages to be
cached, to distinguish between different groups of packages
and to flush the cache folder. The default is -1, which means
no caching.

### Outputs

- **`typst-version`:** The version of `typst` that was installed. This will be
something like `0.10.0` or similar.
- **`typst-version`:** The version of `typst` that was
installed. This will be something like `0.10.0` or similar.

- **`cache-hit`:** Whether or not Typst was restored from the runner's cache or
download anew.
- **`cache-hit`:** Whether or not Typst was restored from the
runner's cache or download anew.

## Development

![Node.js](https://img.shields.io/static/v1?style=for-the-badge&message=Node.js&color=339933&logo=Node.js&logoColor=FFFFFF&label=)

**How do I test my changes?**

Open a Draft Pull Request and some magic GitHub Actions will run to test the
action.
Open a Draft Pull Request and some magic GitHub Actions will run
to test the action.

[typst]: https://typst.app/
[typst/typst]: https://github.com/typst/typst
9 changes: 8 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ inputs:
${{ github.server_url == 'https://github.com' && github.token || '' }}
typst-version:
description: >
Which version of 'typst' to install. This can be an exact version like
The version of Typst to install. This can be an exact version like
'0.10.0' or a semver range like '0.10' or '0.x'. You can also specify
'latest' to always use the latest version. The default is 'latest'.
default: latest
packages-id:
description: >
The identifier of a group of packages to be cached, to distinguish
between different groups of packages and to flush the cache folder. The
default is -1, which means no caching.
default: -1

outputs:
typst-version:
Expand All @@ -32,3 +38,4 @@ outputs:
runs:
using: node20
main: dist/main.js
post: dist/post.js
Loading