Add cross-platform build and release workflows

This commit is contained in:
2026-07-18 20:26:06 -04:00
parent b6554de5a0
commit 1e765344e5
4 changed files with 250 additions and 2 deletions
+62
View File
@@ -0,0 +1,62 @@
name: CI
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
TYPST_COMMIT: 44b3f78ed37fedea75e911dde2269ef86c45316f
jobs:
frontend:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install dependencies
run: bun install
- name: Type check
run: bun run check
- name: Build
run: bun run build
backend:
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: typst-desktop
- name: Clone Typst compiler
run: |
git clone https://github.com/typst/typst.git typstdrive/typst
git -C typstdrive/typst checkout "$TYPST_COMMIT"
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libgtk-3-dev libssl-dev
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: typst-desktop/src-tauri
- name: Check
working-directory: typst-desktop/src-tauri
run: cargo check
+116
View File
@@ -0,0 +1,116 @@
name: Build and Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Release tag to publish, for example v1.0.0"
required: false
env:
TYPST_COMMIT: 44b3f78ed37fedea75e911dde2269ef86c45316f
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-22.04
target: ""
label: linux-x86_64
- platform: windows-latest
target: ""
label: windows-x86_64
- platform: macos-latest
target: aarch64-apple-darwin
label: macos-aarch64
- platform: macos-latest
target: x86_64-apple-darwin
label: macos-x86_64
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
path: typst-desktop
- name: Clone Typst compiler
shell: bash
run: |
git clone https://github.com/typst/typst.git typstdrive/typst
git -C typstdrive/typst checkout "$TYPST_COMMIT"
- name: Set up Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo
uses: Swatinem/rust-cache@v2
with:
workspaces: typst-desktop/src-tauri
key: ${{ matrix.label }}
- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
libgtk-3-dev \
build-essential \
curl \
wget \
file \
libssl-dev
- name: Install frontend dependencies
working-directory: typst-desktop
run: bun install
- name: Build application
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
projectPath: typst-desktop
tagName: ${{ github.ref_type == 'tag' && github.ref_name || inputs.version }}
releaseName: Typst Desktop ${{ github.ref_type == 'tag' && github.ref_name || inputs.version }}
releaseBody: "Download the installer for your platform below."
releaseDraft: true
prerelease: false
args: ${{ matrix.target && format('--target {0}', matrix.target) || '' }}
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: typst-desktop-${{ matrix.label }}
path: |
typst-desktop/src-tauri/target/release/bundle/**/*.deb
typst-desktop/src-tauri/target/release/bundle/**/*.rpm
typst-desktop/src-tauri/target/release/bundle/**/*.AppImage
typst-desktop/src-tauri/target/release/bundle/**/*.dmg
typst-desktop/src-tauri/target/release/bundle/**/*.msi
typst-desktop/src-tauri/target/release/bundle/**/*.exe
typst-desktop/src-tauri/target/*/release/bundle/**/*.dmg
if-no-files-found: ignore
+43 -1
View File
@@ -132,12 +132,54 @@ bun install
bun run tauri dev
```
To build a release bundle:
To build a release bundle for your own platform:
```bash
bun run tauri build
```
## Distribution
Installers are built by the `Build and Release` workflow, which runs on every `v*` tag and can also be started manually. It produces a draft GitHub release with an installer for each platform.
| Platform | Artifacts |
|---|---|
| Linux | `.deb`, `.rpm`, `.AppImage` |
| Windows | `.msi`, `-setup.exe` (NSIS) |
| macOS | `.dmg` for Apple Silicon and Intel, built separately |
To cut a release:
```bash
git tag v1.0.0
git push origin v1.0.0
```
The workflow drafts the release so you can review the artifacts before publishing.
### Platform notes
Each runner builds natively, so no cross-compilation is involved. `.msi` packages can only be built on Windows because the WiX Toolset is Windows-only, which is why the Windows job runs on a Windows runner rather than cross-compiling with `cargo-xwin`.
The Windows installers download the WebView2 bootstrapper when the runtime is missing. Windows 10 (April 2018 or later) and Windows 11 already ship it, so this only affects older systems. The NSIS installer asks whether to install for the current user or the whole machine.
macOS builds are unsigned. Gatekeeper will refuse to open the app until you either sign it with an Apple Developer ID or right-click the app and choose **Open** once. Signing and notarization need `APPLE_CERTIFICATE`, `APPLE_CERTIFICATE_PASSWORD`, `APPLE_SIGNING_IDENTITY`, `APPLE_ID`, `APPLE_PASSWORD`, and `APPLE_TEAM_ID` as repository secrets; the workflow picks them up automatically once they exist.
### Building locally for another platform
Building on the target platform is the supported path. The Typst compiler is a path dependency, so any machine or runner needs it checked out beside this repository:
```bash
git clone https://github.com/typst/typst.git ../typstdrive/typst
git -C ../typstdrive/typst checkout 44b3f78ed37fedea75e911dde2269ef86c45316f
```
Linux builds also need the WebKit and GTK development packages:
```bash
sudo apt-get install libwebkit2gtk-4.1-dev libgtk-3-dev librsvg2-dev patchelf
```
## License
Apache License 2.0. See [LICENSE](LICENSE).
+29 -1
View File
@@ -27,12 +27,40 @@
"bundle": {
"active": true,
"targets": "all",
"createUpdaterArtifacts": false,
"publisher": "SirBlobby",
"copyright": "Copyright (c) 2026 SirBlobby",
"category": "Productivity",
"shortDescription": "A desktop editor for Typst",
"longDescription": "A desktop editor for Typst documents with a built-in compiler, live preview, and optional sync to a TypstDrive server.",
"homepage": "https://github.com/sirblobby/typst-desktop",
"licenseFile": "../LICENSE",
"icon": [
"icons/32x32.png",
"icons/128x128.png",
"icons/[email protected]",
"icons/icon.icns",
"icons/icon.ico"
]
],
"linux": {
"deb": {
"depends": [
"libwebkit2gtk-4.1-0",
"libgtk-3-0"
]
}
},
"windows": {
"webviewInstallMode": {
"type": "downloadBootstrapper"
},
"nsis": {
"installMode": "both",
"displayLanguageSelector": false
}
},
"macOS": {
"minimumSystemVersion": "10.15"
}
}
}