Skip to content

Commit e6662c8

Browse files
ci: add build tests for other versions of typst-docs
Resolves #7
1 parent a50e1d3 commit e6662c8

File tree

1 file changed

+88
-3
lines changed

1 file changed

+88
-3
lines changed

.github/workflows/ci.yaml

Lines changed: 88 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ jobs:
2020
- task: vitest
2121
name: "Run test runner"
2222
command: "bun run test"
23-
- task: build
24-
name: "Run Vite build"
25-
command: "bun run build"
23+
name: Run ${{ matrix.task }}
2624
steps:
2725
- name: Checkout the repository
2826
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -34,3 +32,90 @@ jobs:
3432
run: bun run fetch-docs-ja-jp
3533
- name: ${{ matrix.name }}
3634
run: ${{ matrix.command }}
35+
36+
build:
37+
runs-on: ubuntu-24.04
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
kind: [official]
42+
tag:
43+
- v0.14.0-rc.1
44+
- main.2025-09-19.586b049
45+
- v0.13.1
46+
# These are `docs-*` tags in https://github.com/typst-community/dev-builds.
47+
# To create new tests, trigger the workflow in that repo.
48+
base:
49+
- "/"
50+
- "/docs/"
51+
include:
52+
- kind: ja-JP
53+
tag: latest
54+
base: "/docs/"
55+
name: |
56+
Build for ${{ matrix.kind }} ${{ matrix.tag }} (base: ${{ matrix.base }})
57+
steps:
58+
- name: Checkout the repository
59+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60+
- name: Setup tools managed by mise
61+
uses: jdx/mise-action@13abe502c30c1559a5c37dff303831bab82c9402 # v2.2.3
62+
- name: Install dependencies
63+
run: bun install --frozen-lockfile
64+
65+
- name: Fetch docs assets
66+
if: ${{ matrix.kind == 'ja-JP' }}
67+
run: bun run fetch-docs-ja-jp
68+
69+
- name: Setup other tools
70+
if: ${{ matrix.kind == 'official' }}
71+
uses: taiki-e/install-action@v2
72+
with:
73+
tool: sd
74+
- name: Fetch docs assets
75+
if: ${{ matrix.kind == 'official' }}
76+
shell: bash
77+
run: |
78+
set -euxo pipefail
79+
80+
# Prepare docs.json
81+
curl -L https://github.com/typst-community/dev-builds/releases/download/docs-${{ matrix.tag }}/docs.json \
82+
-o public/docs.json
83+
sd '/DOCS-BASE/' '${{ matrix.base }}' public/docs.json
84+
85+
# Prepare docs assets
86+
curl -LO https://github.com/typst-community/dev-builds/releases/download/docs-${{ matrix.tag }}/docs-assets.zip
87+
unzip docs-assets.zip
88+
mv assets public/assets
89+
90+
# Prepare favicon
91+
curl -L https://github.com/typst-community/org/raw/main/design/typst-community.icon.png \
92+
-o public/favicon.png
93+
94+
# Configure metadata
95+
TAG=${{ matrix.tag }}
96+
# Strip the leading ‘v’ or convert to a valid format
97+
${{ startsWith(matrix.tag, 'v') && 'VERSION=${TAG#v}' || 'VERSION="0.dev.${TAG}"' }}
98+
cat << EOF > public/metadata.json
99+
{
100+
"\$schema": "../metadata.schema.json",
101+
"language": "en-US",
102+
"version": "$VERSION",
103+
"typstOfficialUrl": "https://typst.app",
104+
"typstOfficialDocsUrl": "https://typst.app/docs/",
105+
"githubOrganizationUrl": "https://github.com/typst-community",
106+
"githubRepositoryUrl": "https://github.com/typst-community/typst-docs-web",
107+
"discordServerUrl": "https://discord.gg/2uDybryKPe",
108+
"originUrl": "https://example.com/",
109+
"basePath": "${{ matrix.base }}",
110+
"displayTranslationStatus": false
111+
}
112+
EOF
113+
114+
- name: Run Vite build
115+
run: bun run build
116+
- uses: actions/upload-artifact@v4
117+
# Due to the limit of the artifact naming rule, we upload only one for each group.
118+
if: ${{ matrix.base == '/' || matrix.kind == 'ja-jP' }}
119+
with:
120+
name: dist-${{ matrix.kind }}-${{ matrix.tag }}
121+
path: dist

0 commit comments

Comments
 (0)