Skip to content

Commit 12bb053

Browse files
committed
Merge tag 'v0.12.0'
2 parents 4463bad + 737895d commit 12bb053

File tree

743 files changed

+38944
-21280
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

743 files changed

+38944
-21280
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
runs-on: ${{ matrix.os }}
3131
steps:
3232
- uses: actions/checkout@v4
33-
- uses: dtolnay/rust-toolchain@1.77.0
33+
- uses: dtolnay/rust-toolchain@1.81.0
3434
- uses: Swatinem/rust-cache@v2
3535
- run: cargo test --workspace --no-run
3636
- run: cargo test --workspace --no-fail-fast
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-latest
4141
steps:
4242
- uses: actions/checkout@v4
43-
- uses: dtolnay/rust-toolchain@1.77.0
43+
- uses: dtolnay/rust-toolchain@1.81.0
4444
with:
4545
components: clippy, rustfmt
4646
- uses: Swatinem/rust-cache@v2
@@ -49,11 +49,11 @@ jobs:
4949
- run: cargo doc --workspace --no-deps
5050

5151
min-version:
52-
name: Check mininum Rust version
52+
name: Check minimum Rust version
5353
runs-on: ubuntu-latest
5454
steps:
5555
- uses: actions/checkout@v4
56-
- uses: dtolnay/rust-toolchain@1.74.0
56+
- uses: dtolnay/rust-toolchain@1.77.0
5757
- uses: Swatinem/rust-cache@v2
5858
- run: cargo check --workspace
5959

@@ -64,7 +64,7 @@ jobs:
6464
- uses: actions/checkout@v4
6565
- uses: dtolnay/rust-toolchain@master
6666
with:
67-
toolchain: nightly-2023-09-13
67+
toolchain: nightly-2024-06-01
6868
- uses: Swatinem/rust-cache@v2
6969
- run: cargo install --locked [email protected]
7070
- run: cd tests/fuzz && cargo fuzz build --dev

.github/workflows/docker-image.yml

Lines changed: 93 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,49 @@ name: Build and Publish Docker Image
22

33
on:
44
release:
5-
types: [created]
5+
types: [published]
66
workflow_dispatch:
77

88
env:
99
REGISTRY: ghcr.io
10-
IMAGE_NAME: ${{ github.repository }}
11-
PLATFORMS: linux/amd64,linux/arm64
1210

1311
jobs:
14-
build-and-publish:
12+
build:
13+
name: Build Images
1514
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
platform:
19+
- linux/amd64
20+
- linux/arm64
1621
permissions:
1722
contents: read
1823
packages: write
1924

2025
steps:
26+
- name: Prepare
27+
run: |
28+
platform=${{ matrix.platform }}
29+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
30+
echo "IMAGE_NAME=${REGISTRY}/${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV
31+
2132
- name: Checkout repository
2233
uses: actions/checkout@v4
2334

35+
- name: Get current date
36+
run: echo "TYPST_BUILD_DATE=\"$(date -u +'%Y-%m-%dT%H:%M:%SZ')\" >> $GITHUB_ENV"
37+
2438
- name: Setup Docker buildx
2539
uses: docker/[email protected]
2640
with:
27-
platforms: ${{ env.PLATFORMS }}
41+
platforms: ${{ matrix.platform }}
42+
43+
- name: Extract Docker metadata
44+
id: meta
45+
uses: docker/[email protected]
46+
with:
47+
images: ${{ env.IMAGE_NAME }}
2848

2949
- name: Log into registry ${{ env.REGISTRY }}
3050
uses: docker/[email protected]
@@ -33,19 +53,76 @@ jobs:
3353
username: ${{ github.actor }}
3454
password: ${{ secrets.GITHUB_TOKEN }}
3555

36-
- name: Extract Docker metadata
37-
id: meta
38-
uses: docker/[email protected]
39-
with:
40-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41-
42-
- name: Build and push Docker image
43-
id: build-and-push
56+
- name: Build Docker image
57+
id: build
4458
uses: docker/[email protected]
4559
with:
46-
push: true
47-
tags: ${{ steps.meta.outputs.tags }}
4860
labels: ${{ steps.meta.outputs.labels }}
49-
platforms: ${{ env.PLATFORMS }}
61+
platforms: ${{ matrix.platform }}
62+
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
5063
cache-from: type=gha
5164
cache-to: type=gha,mode=max
65+
build-args: |
66+
REVISION=${{ github.sha }}
67+
CREATED=${{ env.TYPST_BUILD_DATE }}
68+
69+
- name: Export digest
70+
run: |
71+
mkdir -p /tmp/digests
72+
digest="${{ steps.build.outputs.digest }}"
73+
touch "/tmp/digests/${digest#sha256:}"
74+
75+
- name: Upload digest
76+
uses: actions/upload-artifact@v4
77+
with:
78+
name: digests-${{ env.PLATFORM_PAIR }}
79+
path: /tmp/digests/*
80+
if-no-files-found: error
81+
retention-days: 1
82+
83+
merge:
84+
name: Merge and Publish
85+
runs-on: ubuntu-latest
86+
needs:
87+
- build
88+
89+
permissions:
90+
contents: read
91+
packages: write
92+
93+
steps:
94+
- name: Prepare
95+
run: |
96+
echo "IMAGE_NAME=${REGISTRY}/${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV
97+
98+
- name: Download digests
99+
uses: actions/download-artifact@v4
100+
with:
101+
path: /tmp/digests
102+
pattern: digests-*
103+
merge-multiple: true
104+
105+
- name: Set up Docker Buildx
106+
uses: docker/setup-buildx-action@v3
107+
108+
- name: Docker meta
109+
id: meta
110+
uses: docker/metadata-action@v5
111+
with:
112+
images: ${{ env.IMAGE_NAME }}
113+
114+
- name: Log into registry ${{ env.REGISTRY }}
115+
uses: docker/[email protected]
116+
with:
117+
registry: ${{ env.REGISTRY }}
118+
username: ${{ github.actor }}
119+
password: ${{ secrets.GITHUB_TOKEN }}
120+
121+
- name: Create manifest list and push
122+
working-directory: /tmp/digests
123+
run: |
124+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
125+
$(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *)
126+
- name: Inspect image
127+
run: |
128+
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}

.github/workflows/forum.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Move to Typst Forum
2+
on:
3+
issues:
4+
types:
5+
- labeled
6+
jobs:
7+
add-comment:
8+
if: github.event.label.name == 'to-forum'
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
steps:
13+
- name: Call Discourse API to create forum post
14+
env:
15+
ISSUE_BODY: ${{ github.event.issue.body }}
16+
ISSUE_TITLE: ${{ github.event.issue.title }}
17+
ISSUE_NUMBER: ${{ github.event.issue.number }}
18+
ISSUE_URL: ${{ github.event.issue.html_url }}
19+
ISSUE_USER_LOGIN: ${{ github.event.issue.user.login }}
20+
REPOSITORY_OWNER: ${{ github.repository_owner }}
21+
run: |
22+
read -d '' RAW << END_OF_BODY
23+
This topic was moved from GitHub issue ${ISSUE_NUMBER}. Please continue the conversation here.
24+
25+
Here is the original issue:
26+
[quote="${ISSUE_USER_LOGIN}"]
27+
${ISSUE_BODY}
28+
[/quote]
29+
30+
Browse the previous discussion at ${ISSUE_URL}
31+
END_OF_BODY
32+
33+
TITLE_JSON=$(jq -n --arg title "[#${ISSUE_NUMBER}] ${ISSUE_TITLE}" '$title')
34+
RAW_JSON=$(jq -n --arg raw "$RAW" '$raw')
35+
EXTERNAL_ID_JSON=$(jq -n --arg external_id "gh-${REPOSITORY_OWNER}-typst-${ISSUE_NUMBER}" '$external_id')
36+
37+
RESPONSE=$(curl -X POST "https://forum.typst.app/posts.json" \
38+
--fail-with-body \
39+
-H "Api-Key: ${{ secrets.DISCOURSE_TOKEN }}" \
40+
-H "Content-Type: application/json" \
41+
-d "{
42+
\"title\": $TITLE_JSON,
43+
\"category\": 4,
44+
\"external_id\": $EXTERNAL_ID_JSON,
45+
\"raw\": $RAW_JSON
46+
}")
47+
48+
# Check if response contains errors
49+
if [ $(jq -n --argjson response "$RESPONSE" '$response.errors | length') -gt 0 ]; then
50+
# Join the errors with commas
51+
ERRORS=$(jq -n --argjson response "$RESPONSE" '$response.errors | join(", ")')
52+
echo "DISCOURSE_ERROR=$ERRORS" >> $GITHUB_ENV
53+
exit 1
54+
fi
55+
56+
# Check if the response returned a non-200 status code
57+
if [ $? -ne 0 ]; then
58+
echo "DISCOURSE_ERROR=Failed to call the Discourse API" >> $GITHUB_ENV
59+
exit 1
60+
fi
61+
62+
THREAD_ID="$(jq -n --argjson response "$RESPONSE" '$response.topic_id')"
63+
if [ "$THREAD_ID" = 'null' ]; then
64+
echo "DISCOURSE_ERROR=Failed to retrieve new thread ID" >> $GITHUB_ENV
65+
exit 1
66+
fi
67+
68+
echo "THREAD_ID=$THREAD_ID" >> $GITHUB_ENV
69+
- name: Add a comment if the workflow failed
70+
if: failure()
71+
run: |
72+
gh issue comment ${{ github.event.issue.number }} --body "Failed to move this issue to the Typst Forum. This is the error that the API call returned: $DISCOURSE_ERROR"
73+
- name: Add comment and close as not planned
74+
run: |
75+
gh issue close "$NUMBER" --reason "not planned" --comment "$BODY"
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
GH_REPO: ${{ github.repository }}
79+
NUMBER: ${{ github.event.issue.number }}
80+
BODY: >
81+
We moved this issue to the Typst Forum. Please continue the discussion there: https://forum.typst.app/t/${{ env.THREAD_ID }}

.github/workflows/release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ jobs:
2525
- target: armv7-unknown-linux-musleabi
2626
os: ubuntu-latest
2727
cross: true
28+
- target: riscv64gc-unknown-linux-gnu
29+
os: ubuntu-latest
30+
cross: true
2831
- target: x86_64-apple-darwin
2932
os: macos-latest
3033
cross: false
@@ -34,17 +37,20 @@ jobs:
3437
- target: x86_64-pc-windows-msvc
3538
os: windows-latest
3639
cross: false
40+
- target: aarch64-pc-windows-msvc
41+
os: windows-latest
42+
cross: false
3743

3844
steps:
3945
- uses: actions/checkout@v4
40-
- uses: dtolnay/rust-toolchain@1.77.0
46+
- uses: dtolnay/rust-toolchain@1.81.0
4147
with:
4248
target: ${{ matrix.target }}
4349

4450
- name: Run Cross
4551
if: ${{ matrix.cross }}
4652
run: |
47-
cargo install cross --git https://github.com/cross-rs/cross.git
53+
cargo install cross --git https://github.com/cross-rs/cross.git --locked --rev 085092ca
4854
cross build -p typst-cli --release --target ${{ matrix.target }} --features self-update,vendor-openssl
4955
5056
- name: Run Cargo

CITATION.cff

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
cff-version: 1.2.0
2+
title: Typst
3+
message: >-
4+
If you use this software, please cite it using the
5+
metadata from this file.
6+
type: software
7+
authors:
8+
- given-names: Laurenz
9+
family-names: Mädje
10+
11+
- given-names: Martin
12+
family-names: Haug
13+
14+
- name: The Typst Project Developers
15+
references:
16+
- title: A Programmable Markup Language for Typesetting
17+
authors:
18+
- family-names: Mädje
19+
given-names: Laurenz
20+
year: 2022
21+
type: thesis
22+
thesis-type: Master's thesis
23+
url: https://laurmaedje.github.io/programmable-markup-language-for-typesetting.pdf
24+
institution:
25+
name: Technische Universität Berlin
26+
- title: Fast typesetting with incremental compilation
27+
authors:
28+
- family-names: Haug
29+
given-names: Martin
30+
year: 2022
31+
type: thesis
32+
thesis-type: Master's thesis
33+
doi: 10.13140/RG.2.2.15606.88642
34+
url: https://doi.org/10.13140/RG.2.2.15606.88642
35+
institution:
36+
name: Technische Universität Berlin
37+
repository-code: 'https://github.com/typst/typst'
38+
url: 'https://typst.app/'
39+
keywords:
40+
- typesetting
41+
- markup language
42+
license: Apache-2.0

0 commit comments

Comments
 (0)