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
29 changes: 18 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
name: Test
on:
push:
branches: "main"
branches: [ main ]
paths-ignore:
- .gitattributes
- .gitignore
- README*.md
- '**.md'
- LICENSE
- .github/**
- "!.github/workflows/test-action.yml"
- '!.github/workflows/test.yml'
pull_request:
paths-ignore:
- .gitattributes
- .gitignore
- README*.md
- '**.md'
- LICENSE
- .github/**
- "!.github/workflows/test-action.yml"
- '!.github/workflows/test.yml'
types:
- opened
- synchronize
- reopened
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -26,7 +32,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
node-version: '20'
cache: npm
- run: npm ci
- run: npm run build
Expand All @@ -49,10 +55,10 @@ jobs:
path: ./dist
- uses: ./
with:
cache-dependency-path: test/basic-requirements.typ
cache-dependency-path: test/basic/requirements.typ
- run: typst --version
- run: typst compile test/basic.typ
test-local-packages:
- run: typst compile test/basic/main.typ
test-zip-packages:
runs-on: ${{ matrix.os }}
needs: build
strategy:
Expand All @@ -67,7 +73,8 @@ jobs:
path: ./dist
- uses: ./
with:
local-packages: test/local-packages.json
typst-version: v0.13
zip-packages: test/zip-packages/requirements.json
cache-local-packages: true
- run: typst --version
- run: typst compile test/local-packages.typ
- run: typst compile test/zip-packages/main.typ
16 changes: 9 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,30 +70,32 @@ 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.
- **`cache-local-packages`:** When `true`, local packages set by `local-packages` will be cached independently of `@preview` packages.
- **`zip-packages`:** Used to specify the path to a JSON file containing names and ZIP archive URLs of packages.
- **`cache-local-packages`:** When `true`, local packages set by `zip-packages` will be cached independently of `@preview` packages.

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

```js
// Example JSON file (packages.json)
// Example JSON file (requirements.json)
{
"preview": {
"algorithmic": "https://github.com/typst-community/typst-algorithmic/archive/refs/tags/v1.0.0.zip"
},
"local": {
"glossarium": "https://github.com/typst-community/glossarium/archive/refs/tags/v0.5.4.zip",
"touying": "https://github.com/touying-typ/touying/archive/refs/tags/0.6.1.zip"
"glossarium": "https://github.com/typst-community/glossarium/archive/refs/tags/v0.5.7.zip"
}
}
```

> [!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`.
> - The supported namespaces are only `local` and `preview`. The SemVer versions of packages are read from its `typst.toml`.

#### Token

Expand Down
22 changes: 12 additions & 10 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
- **缓存**依赖的[包]
- **缓存**依赖的 [包]
- **下载** ZIP 压缩文件作为本地包

```yaml
Expand Down Expand Up @@ -70,30 +70,32 @@ jobs:

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

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

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

```js
// Example JSON file (packages.json)
// Example JSON file (requirements.json)
{
"preview": {
"algorithmic": "https://github.com/typst-community/typst-algorithmic/archive/refs/tags/v1.0.0.zip"
},
"local": {
"glossarium": "https://github.com/typst-community/glossarium/archive/refs/tags/v0.5.4.zip",
"touying": "https://github.com/touying-typ/touying/archive/refs/tags/0.6.1.zip"
"glossarium": "https://github.com/typst-community/glossarium/archive/refs/tags/v0.5.7.zip"
}
}
```

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

#### 令牌

Expand All @@ -108,7 +110,7 @@ jobs:

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

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

```yaml
- uses: typst-community/setup-typst@v4
Expand Down
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ inputs:
cache-dependency-path:
description: "Used to specify the path to a Typst file containing lines of 'import' keyword."
required: false
zip-packages:
description: "Used to specify the path to a JSON file containing names and ZIP archive URLs of packages."
required: false
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."
description: "[Deprecated] Used to specify the path to a JSON file containing names and ZIP archive URLs of packages."
required: false
cache-local-packages:
description: "When 'true', local packages set by 'local-packages' will be cached independently of '@preview' packages."
Expand Down
Loading
Loading