Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,6 @@ jobs:
- uses: ./
with:
local-packages: test/local-packages.json
cache-local-packages: true
- run: typst --version
- run: typst compile test/local-packages.typ
25 changes: 18 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
This action provides the following functionality for GitHub Actions users:

- **Installing** a version of Typst and adding it to the PATH
- **Caching** [packages](https://github.com/typst/packages) dependencies
- **Downloading** ZIP archive as local packages
- **Caching** [packages] dependencies
- **Downloading** ZIP archives as local packages

```yaml
- uses: typst-community/setup-typst@v4
Expand Down Expand Up @@ -70,17 +70,19 @@ jobs:

#### ZIP archive packages download

**`local-packages`:** Used to specify the path to a JSON file containing names and ZIP archive URLs of packages as local packages under the `local` key.
- **`local-packages`:** Used to specify the path to a JSON file containing names and ZIP archive URLs of packages as local packages under the `local` key.
- **`cache-local-packages`:** When `true`, local packages set by `local-packages` will be cached independently of `@preview` packages.

```yaml
# Example workflow YAML file
- uses: typst-community/setup-typst@v4
with:
local-packages: packages.json
cache-local-packages: true
```

```js
// Example JSON file (packages.js)
// Example JSON file (packages.json)
{
"local": {
"glossarium": "https://github.com/typst-community/glossarium/archive/refs/tags/v0.5.4.zip",
Expand All @@ -89,6 +91,10 @@ jobs:
}
```

> [!NOTE]
> - For links to download GitHub repositories, please refer to [_Downloading source code archives_].
> - The namespace for local packages is `local`. The SemVer versions of local packages are read from its `typst.toml`.

#### Token

**`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.
Expand All @@ -102,6 +108,8 @@ jobs:

#### Uploading workflow artifact

If you require storing and sharing data from a workflow, you can use [artifacts].

```yaml
- uses: typst-community/setup-typst@v4
- run: typst compile paper.typ paper.pdf
Expand All @@ -111,9 +119,9 @@ jobs:
path: paper.pdf
```

#### Expanding font support with Fontist
#### Installing fonts with Fontist

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:
If you require installing fonts in GitHub Actions runner, you can use [Fontist].

```yaml
- uses: fontist/setup-fontist@v2
Expand All @@ -124,4 +132,7 @@ If your tasks require extending beyond the set of fonts in GitHub Actions runner

[Typst]: https://typst.app/
[typst/typst]: https://github.com/typst/typst
[fontist/setup-fontist]: https://github.com/fontist/setup-fontist
[packages]: https://github.com/typst/packages
[_Downloading source code archives_]: https://docs.github.com/en/repositories/working-with-files/using-files/downloading-source-code-archives
[artifacts]: https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/storing-and-sharing-data-from-a-workflow
[Fontist]: https://www.fontist.org/
25 changes: 18 additions & 7 deletions README_zh-Hans-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
此操作为 GitHub Actions 用户提供以下功能:

- **安装**指定版本的 Typst
- **缓存**依赖的[包](https://github.com/typst/packages)
- **缓存**依赖的[包]
- **下载** ZIP 压缩文件作为本地包

```yaml
Expand Down Expand Up @@ -70,17 +70,19 @@ jobs:

#### ZIP 压缩文件作为包下载

**`local-packages`:** 指向一个在 `local` 键下有包名称与对应 ZIP 压缩文件 URL 的 JSON 文件。
- **`local-packages`:** 指向一个在 `local` 键下有包名称与对应 ZIP 压缩文件 URL 的 JSON 文件。
- **`cache-local-packages`:** 当设置为 `true` 时,在 `local-packages` 中设定的包将被缓存(缓存独立于 `@preview` 包)。

```yaml
# Example workflow YAML file
- uses: typst-community/setup-typst@v4
with:
local-packages: packages.json
cache-local-packages: true
```

```js
// Example JSON file (packages.js)
// Example JSON file (packages.json)
{
"local": {
"glossarium": "https://github.com/typst-community/glossarium/archive/refs/tags/v0.5.4.zip",
Expand All @@ -89,6 +91,10 @@ jobs:
}
```

> [!NOTE]
> - 对于下载 GitHub 存储库需要的链接,请参阅 [《下载源代码存档》]。
> - 本地包的命名空间为 `local`,SemVer 版本号从 `typst.toml` 读取。

#### 令牌

**`token`:** 当从 [typst/typst] 拉取版本时使用的 GitHub 令牌。当在 github.com 上运行操作时,使用默认值;当在 GitHub Enterprise Server(GHES)上运行,可以传递一个 github.com 的个人访问令牌规避速率限制问题。
Expand All @@ -100,7 +106,9 @@ jobs:

### 自定义组合

#### 上传到工作流工件
#### 上传到工作流构件

如果需要从工作流存储和共享数据,可以使用[构件]。

```yaml
- uses: typst-community/setup-typst@v4
Expand All @@ -111,9 +119,9 @@ jobs:
path: paper.pdf
```

#### 使用 Fontist 拓展字体支持
#### 使用 Fontist 安装字体

如需为 GitHub Actions 运行器拓展字体库,可使用 Fontist 进行自定义字体安装。以下是使用 [fontist/setup-fontist] 添加新字体的范例:
如果需要在 GitHub Actions 运行器中安装字体,可以使用 [Fontist]。

```yaml
- uses: fontist/setup-fontist@v2
Expand All @@ -124,4 +132,7 @@ jobs:

[Typst]: https://typst.app/
[typst/typst]: https://github.com/typst/typst
[fontist/setup-fontist]: https://github.com/fontist/setup-fontist
[包]: https://github.com/typst/packages
[《下载源代码存档》]: https://docs.github.com/zh/repositories/working-with-files/using-files/downloading-source-code-archives
[构件]: https://docs.github.com/zh/actions/writing-workflows/choosing-what-your-workflow-does/storing-and-sharing-data-from-a-workflow#comparing-artifacts-and-dependency-caching
[Fontist]: https://www.fontist.org/
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ inputs:
local-packages:
description: "Used to specify the path to a JSON file containing names and ZIP archive URLs of packages as local packages under the 'local' key."
required: false
cache-local-packages:
description: "When 'true', local packages set by 'local-packages' will be cached independently of '@preview' packages."
default: false
token:
description: "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."
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
Expand Down
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading