Add cross-platform build and release workflows
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user