Skip to content

Commit 318f0bc

Browse files
committed
Initial commit
This is in large part copied from https://github.com/typst-community/setup-shiroa and as such, heavily inspired by https://github.com/typst-community/setup-typst.
0 parents  commit 318f0bc

File tree

24 files changed

+1105
-0
lines changed

24 files changed

+1105
-0
lines changed

.github/workflows/ci.yml

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
name: Test action
2+
3+
on:
4+
push:
5+
branches: "main"
6+
paths-ignore:
7+
- .gitignore
8+
- README.md
9+
- LICENSE
10+
11+
pull_request:
12+
paths-ignore:
13+
- .gitignore
14+
- README.md
15+
- LICENSE
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
defaults:
22+
run:
23+
shell: bash
24+
25+
jobs:
26+
test-download:
27+
strategy:
28+
fail-fast: true
29+
matrix:
30+
os: [ubuntu-latest, macos-latest, windows-latest]
31+
tytanic-version:
32+
# Test oldest allowed version
33+
- version: 0.1.0
34+
allow-prereleases: false
35+
36+
# Test latest version with pre releases
37+
- version: latest
38+
allow-prereleases: true
39+
40+
# Test known range
41+
- version: 0.2.x
42+
allow-prereleases: true
43+
44+
# Test pre-release (allow-prereleases doesn't apply to full version)
45+
- version: 0.2.0-rc1
46+
allow-prereleases: false
47+
48+
runs-on: ${{ matrix.os }}
49+
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v4
53+
54+
- name: Setup Node 20
55+
uses: actions/setup-node@v4
56+
with:
57+
node-version: "20"
58+
cache: npm
59+
60+
- name: Clean install
61+
run: npm ci
62+
63+
- name: Build
64+
run: npm run build
65+
66+
- name: Override dist with build
67+
shell: bash
68+
run: |
69+
rm -rf dist
70+
mv build dist
71+
72+
- name: Run action
73+
uses: ./
74+
with:
75+
tytanic-version: ${{ matrix.tytanic-version.version }}
76+
allow-prereleases: ${{ matrix.tytanic-version.allow-prereleases }}
77+
78+
- name: Run `tt --version`
79+
run: tt --version
80+
81+
test-tytanic:
82+
strategy:
83+
fail-fast: true
84+
matrix:
85+
os: [ubuntu-latest, macos-latest, windows-latest]
86+
87+
runs-on: ${{ matrix.os }}
88+
89+
steps:
90+
- name: Checkout
91+
uses: actions/checkout@v4
92+
93+
- name: Setup Node 20
94+
uses: actions/setup-node@v4
95+
with:
96+
node-version: "20"
97+
cache: npm
98+
99+
- name: Clean install
100+
run: npm ci
101+
102+
- name: Build
103+
run: npm run build
104+
105+
- name: Override dist with build
106+
run: |
107+
rm -rf dist
108+
mv build dist
109+
110+
- name: Run action
111+
uses: ./
112+
with:
113+
tytanic-version: 0.2.2
114+
115+
- name: Run `tt run`
116+
run: tt run -r test/package

.github/workflows/upstream-check.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Test upstream downlaod
2+
3+
on:
4+
schedule:
5+
- cron: '0 * * * *'
6+
7+
workflow_dispatch:
8+
9+
defaults:
10+
run:
11+
shell: bash
12+
13+
jobs:
14+
test-upstream:
15+
strategy:
16+
fail-fast: true
17+
matrix:
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node 20
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: "20"
30+
cache: npm
31+
32+
- name: Clean install
33+
run: npm ci
34+
35+
- name: Build
36+
run: npm run build
37+
38+
- name: Override dist with build
39+
run: |
40+
rm -rf dist
41+
mv build dist
42+
43+
- name: Run action
44+
uses: ./
45+
with:
46+
shiroa-version: latest
47+
allow-prereleases: true
48+
49+
- name: Run `tytanic --version`
50+
run: tytanic --version

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# node and ncc output
2+
build/
3+
node_modules/
4+
5+
# shiroa output
6+
test/book/dist/

Justfile

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
prompt := BOLD + GREEN + ">>>" + NORMAL
2+
3+
root := justfile_directory()
4+
5+
alias b := build
6+
alias c := check
7+
alias f := format
8+
alias fmt := format
9+
10+
# list recipes
11+
[private]
12+
default:
13+
@just --list --unsorted
14+
15+
# Install the action dependencies
16+
install:
17+
@echo "{{prompt}} Installing dependencies"
18+
@npm clean-install
19+
20+
# Build the action locally
21+
build: install
22+
@echo "{{prompt}} Building typescript code"
23+
@npm run build
24+
25+
# Run the typescript compiler lints
26+
check: install
27+
@echo "{{prompt}} Linting typescript code"
28+
@npm run lint
29+
30+
# Update the compiled action in dist (for releases)
31+
update: clean install check
32+
@echo "{{prompt}} Updating dist"
33+
@rm --recursive --force {{ root / 'dist' }}
34+
@cp --recursive {{ root / 'build ' }} {{ root / 'dist' }}
35+
36+
# Format the Typescript code
37+
format:
38+
@echo "{{prompt}} Formatting with prettier in src"
39+
@npm run format
40+
41+
# Update the package thumbnail
42+
lock:
43+
@echo "{{prompt}} Updating npm lockfile"
44+
@npm install --package-lock-only
45+
46+
# Clean temporary artifacts
47+
clean:
48+
@rm --recursive --force {{ root / 'node_modules' }}
49+
@rm --recursive --force {{ root / 'dist' }}
50+
@rm --recursive --force {{ root / 'docs' / 'book' / 'dist' }}

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 tinger <tinger@tinger.dev>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Setup Tytanic
2+
This action provides the [Tytanic] CLI to subsequent steps in GitHub Actions.
3+
4+
```yaml
5+
- uses: typst-community/setup-tytanic@v1
6+
- run: tt run
7+
```
8+
9+
## Usage
10+
### Basic usage
11+
```yaml
12+
name: Build GitHub-Pages
13+
on: push
14+
jobs:
15+
build-docs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: typst-community/setup-tytanic@v1
20+
with:
21+
tytanic-version: 0.3.0
22+
- run: tt run
23+
```
24+
25+
### Inputs & Outputs
26+
See [action.yml](action.yml) for a the inputs and outputs of this action.
27+
28+
## Contributions
29+
A contribution guide can be found [here](docs/CONTRIBUTING.md). You can view the changelog of previous contributions and release [here](docs/CHANGELOG.md).
30+
31+
## Credit
32+
This action is in large part inspired by [setup-typst].
33+
34+
[setup-typst]: https://github.com/typst-community/setup-typst
35+
[Tytanic]: https://github.com/typst-community/tytanic

action.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Setup Tytanic
2+
description: Install Tytanic for use in GitHub Actions
3+
4+
branding:
5+
icon: terminal
6+
color: white
7+
8+
inputs:
9+
github-token:
10+
description: >
11+
The GitHub token to use when pulling versions from
12+
typst-community/tytanic. By default this should cover all cases. You
13+
shouldn't have to touch this setting.
14+
default: ${{ github.token }}
15+
16+
tytanic-version:
17+
description: >
18+
The version of Typst to install. This can be an exact version like
19+
'0.10.0' or a semver range like '0.10' or '0.x'. You can also specify
20+
'latest' to always use the latest version. The default is 'latest'.
21+
default: latest
22+
23+
allow-prereleases:
24+
description: >
25+
Whether to allow prereleases when using `latest` or ranges in
26+
`tytanic-version`.
27+
default: false
28+
29+
outputs:
30+
tytanic-version:
31+
description: >
32+
The version of Tytanic that was installed. This will be something like
33+
'0.10.0' or similar.
34+
35+
cache-hit:
36+
description: >
37+
Whether Tytanic was restored from the runner's cache or downloaded.
38+
39+
runs:
40+
using: node20
41+
main: dist/index.js

docs/CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# [unreleased](https://github.com/typst-community/setup-tytanic/releases/tag/)
2+
## Highlights
3+
This is the first release of `setup-tytanic` a GitHub Action that makes [tytanic] available in your CI.
4+
Some notable features of the action are:
5+
- Caching of the downloaded binaries
6+
- Support for using the latest available release
7+
- Support for using the latest pre release
8+
9+
[tytanic]: https://github.com/typst-community/tytanic
10+
11+
## Changes
12+
13+
## Fixes

docs/CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Contributing
2+
Thank you for considering to contribute to this GitHub Action!
3+
4+
Contributing is fairly simple, all you need is Node.js Version 20.
5+
Though, for a better experience we recommend using an editor with the TypeScript Language Server and having the TypeScript Compiler installed.
6+
7+
Run `npm clean-install` to prepare your node environment, then you can add your changes.
8+
To test your code run `npm run lint` and `npm run build`, this will not test the actual code, but it will check that it is correct.
9+
Most of this will be done inline if you have the Language Server running.
10+
11+
Once you push your changes and open a PR you can continuously test by updating the PR, the CI workflows will test the action on some pre-selected inputs.

flake.lock

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)