Skip to content

Commit

Permalink
Merge upstream v0.12.0 (#62)
Browse files Browse the repository at this point in the history
  • Loading branch information
3w36zj6 authored Oct 23, 2024
2 parents 4463bad + 32db60f commit 69f9d41
Show file tree
Hide file tree
Showing 756 changed files with 45,218 additions and 23,920 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.77.0
- uses: dtolnay/rust-toolchain@1.81.0
- uses: Swatinem/rust-cache@v2
- run: cargo test --workspace --no-run
- run: cargo test --workspace --no-fail-fast
Expand All @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.77.0
- uses: dtolnay/rust-toolchain@1.81.0
with:
components: clippy, rustfmt
- uses: Swatinem/rust-cache@v2
Expand All @@ -49,11 +49,11 @@ jobs:
- run: cargo doc --workspace --no-deps

min-version:
name: Check mininum Rust version
name: Check minimum Rust version
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.74.0
- uses: dtolnay/rust-toolchain@1.77.0
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace

Expand All @@ -64,7 +64,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2023-09-13
toolchain: nightly-2024-06-01
- uses: Swatinem/rust-cache@v2
- run: cargo install --locked [email protected]
- run: cd tests/fuzz && cargo fuzz build --dev
109 changes: 93 additions & 16 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,49 @@ name: Build and Publish Docker Image

on:
release:
types: [created]
types: [published]
workflow_dispatch:

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
PLATFORMS: linux/amd64,linux/arm64

jobs:
build-and-publish:
build:
name: Build Images
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/arm64
permissions:
contents: read
packages: write

steps:
- name: Prepare
run: |
platform=${{ matrix.platform }}
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
echo "IMAGE_NAME=${REGISTRY}/${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV
- name: Checkout repository
uses: actions/checkout@v4

- name: Get current date
run: echo "TYPST_BUILD_DATE=\"$(date -u +'%Y-%m-%dT%H:%M:%SZ')\" >> $GITHUB_ENV"

- name: Setup Docker buildx
uses: docker/[email protected]
with:
platforms: ${{ env.PLATFORMS }}
platforms: ${{ matrix.platform }}

- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.IMAGE_NAME }}

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

- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: build-and-push
- name: Build Docker image
id: build
uses: docker/[email protected]
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: ${{ env.PLATFORMS }}
platforms: ${{ matrix.platform }}
outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
REVISION=${{ github.sha }}
CREATED=${{ env.TYPST_BUILD_DATE }}
- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1

merge:
name: Merge and Publish
runs-on: ubuntu-latest
needs:
- build

permissions:
contents: read
packages: write

steps:
- name: Prepare
run: |
echo "IMAGE_NAME=${REGISTRY}/${GITHUB_REPOSITORY@L}" >> $GITHUB_ENV
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
merge-multiple: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.IMAGE_NAME }}

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create manifest list and push
working-directory: /tmp/digests
run: |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
$(printf '${{ env.IMAGE_NAME }}@sha256:%s ' *)
- name: Inspect image
run: |
docker buildx imagetools inspect ${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
81 changes: 81 additions & 0 deletions .github/workflows/forum.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: Move to Typst Forum
on:
issues:
types:
- labeled
jobs:
add-comment:
if: github.event.label.name == 'to-forum'
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Call Discourse API to create forum post
env:
ISSUE_BODY: ${{ github.event.issue.body }}
ISSUE_TITLE: ${{ github.event.issue.title }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
ISSUE_URL: ${{ github.event.issue.html_url }}
ISSUE_USER_LOGIN: ${{ github.event.issue.user.login }}
REPOSITORY_OWNER: ${{ github.repository_owner }}
run: |
read -d '' RAW << END_OF_BODY
This topic was moved from GitHub issue ${ISSUE_NUMBER}. Please continue the conversation here.
Here is the original issue:
[quote="${ISSUE_USER_LOGIN}"]
${ISSUE_BODY}
[/quote]
Browse the previous discussion at ${ISSUE_URL}
END_OF_BODY
TITLE_JSON=$(jq -n --arg title "[#${ISSUE_NUMBER}] ${ISSUE_TITLE}" '$title')
RAW_JSON=$(jq -n --arg raw "$RAW" '$raw')
EXTERNAL_ID_JSON=$(jq -n --arg external_id "gh-${REPOSITORY_OWNER}-typst-${ISSUE_NUMBER}" '$external_id')
RESPONSE=$(curl -X POST "https://forum.typst.app/posts.json" \
--fail-with-body \
-H "Api-Key: ${{ secrets.DISCOURSE_TOKEN }}" \
-H "Content-Type: application/json" \
-d "{
\"title\": $TITLE_JSON,
\"category\": 4,
\"external_id\": $EXTERNAL_ID_JSON,
\"raw\": $RAW_JSON
}")
# Check if response contains errors
if [ $(jq -n --argjson response "$RESPONSE" '$response.errors | length') -gt 0 ]; then
# Join the errors with commas
ERRORS=$(jq -n --argjson response "$RESPONSE" '$response.errors | join(", ")')
echo "DISCOURSE_ERROR=$ERRORS" >> $GITHUB_ENV
exit 1
fi
# Check if the response returned a non-200 status code
if [ $? -ne 0 ]; then
echo "DISCOURSE_ERROR=Failed to call the Discourse API" >> $GITHUB_ENV
exit 1
fi
THREAD_ID="$(jq -n --argjson response "$RESPONSE" '$response.topic_id')"
if [ "$THREAD_ID" = 'null' ]; then
echo "DISCOURSE_ERROR=Failed to retrieve new thread ID" >> $GITHUB_ENV
exit 1
fi
echo "THREAD_ID=$THREAD_ID" >> $GITHUB_ENV
- name: Add a comment if the workflow failed
if: failure()
run: |
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"
- name: Add comment and close as not planned
run: |
gh issue close "$NUMBER" --reason "not planned" --comment "$BODY"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
BODY: >
We moved this issue to the Typst Forum. Please continue the discussion there: https://forum.typst.app/t/${{ env.THREAD_ID }}
10 changes: 8 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- target: armv7-unknown-linux-musleabi
os: ubuntu-latest
cross: true
- target: riscv64gc-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: x86_64-apple-darwin
os: macos-latest
cross: false
Expand All @@ -34,17 +37,20 @@ jobs:
- target: x86_64-pc-windows-msvc
os: windows-latest
cross: false
- target: aarch64-pc-windows-msvc
os: windows-latest
cross: false

steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.77.0
- uses: dtolnay/rust-toolchain@1.81.0
with:
target: ${{ matrix.target }}

- name: Run Cross
if: ${{ matrix.cross }}
run: |
cargo install cross --git https://github.com/cross-rs/cross.git
cargo install cross --git https://github.com/cross-rs/cross.git --locked --rev 085092ca
cross build -p typst-cli --release --target ${{ matrix.target }} --features self-update,vendor-openssl
- name: Run Cargo
Expand Down
42 changes: 42 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
cff-version: 1.2.0
title: Typst
message: >-
If you use this software, please cite it using the
metadata from this file.
type: software
authors:
- given-names: Laurenz
family-names: Mädje
email: [email protected]
- given-names: Martin
family-names: Haug
email: [email protected]
- name: The Typst Project Developers
references:
- title: A Programmable Markup Language for Typesetting
authors:
- family-names: Mädje
given-names: Laurenz
year: 2022
type: thesis
thesis-type: Master's thesis
url: https://laurmaedje.github.io/programmable-markup-language-for-typesetting.pdf
institution:
name: Technische Universität Berlin
- title: Fast typesetting with incremental compilation
authors:
- family-names: Haug
given-names: Martin
year: 2022
type: thesis
thesis-type: Master's thesis
doi: 10.13140/RG.2.2.15606.88642
url: https://doi.org/10.13140/RG.2.2.15606.88642
institution:
name: Technische Universität Berlin
repository-code: 'https://github.com/typst/typst'
url: 'https://typst.app/'
keywords:
- typesetting
- markup language
license: Apache-2.0
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Typst日本語ドキュメント翻訳プロジェクトにご興味をお持ち
2. `./docs`内のMarkdownファイル群は、Typstのチュートリアルや入門ガイドなど、言語リファレンス以外のページの本体です。**既存のMarkdownファイルを直接書き換えて翻訳してください**
それに加えて、`./docs/src/lib.rs`ファイルの[`urlify`関数](https://github.com/search?q=repo%3Atypst-jp/typst-jp.github.io%20urlify&type=code)を編集して、中国語版の記事タイトルを日本語版のものに書き換えてください。このプロセスを抜かすと、WebページのURLが正しく生成されません。
3. 「サードパーティパッケージ」のページの翻訳を追加する場合は、`./static/assets/index2ja.json`も編集する必要があります。
3. 翻訳の際は、[後述のガイドライン](#スタイルマニュアル)を参照し、[v0.11.1時点での公式ドキュメント](https://github.com/typst/typst/tree/v0.11.1/docs)から翻訳してください。
3. 翻訳の際は、[後述のガイドライン](#スタイルマニュアル)を参照し、[v0.12.0時点での公式ドキュメント](https://github.com/typst/typst/tree/v0.12.0/docs)から翻訳してください。
4. 翻訳作業の途中でも、Draft Pull Requestを作成して、翻訳の進捗状況を共有することができます。
5. 翻訳作業が終わったら、Pull Requestを作成し、送信してください。

Expand Down
Loading

0 comments on commit 69f9d41

Please sign in to comment.