mirror of
https://github.com/open-jarvis/OpenJarvis.git
synced 2026-07-28 14:07:55 +00:00
macos-latest now resolves to macOS 15 (Sequoia), which removed the SetFile command from Xcode Command Line Tools. Tauri's bundle_dmg.sh relies on SetFile to set custom icon attributes on the DMG volume, causing the Desktop Build & Release workflow to fail on the macOS runner. Pin to macos-14 (Apple Silicon M1, Sonoma) which still includes SetFile and supports universal binary builds. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
223 lines
6.9 KiB
YAML
223 lines
6.9 KiB
YAML
name: Desktop Build & Release
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'desktop/**'
|
|
- 'frontend/**'
|
|
- '.github/workflows/desktop.yml'
|
|
tags:
|
|
- 'desktop-v*'
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- 'desktop/**'
|
|
- 'frontend/**'
|
|
- '.github/workflows/desktop.yml'
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: desktop-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
validate:
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libwebkit2gtk-4.1-dev \
|
|
libgtk-3-dev \
|
|
libappindicator3-dev \
|
|
librsvg2-dev \
|
|
patchelf \
|
|
libxdo-dev
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install frontend dependencies
|
|
working-directory: frontend
|
|
run: npm install
|
|
|
|
- name: Install desktop dependencies
|
|
working-directory: desktop
|
|
run: npm install
|
|
|
|
- name: TypeScript type-check
|
|
working-directory: frontend
|
|
run: npx tsc --noEmit
|
|
|
|
- name: Install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Rust cache
|
|
uses: swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: 'desktop/src-tauri -> target'
|
|
|
|
- name: Create frontend dist stub
|
|
run: mkdir -p frontend/dist && echo '<html><body></body></html>' > frontend/dist/index.html
|
|
|
|
- name: Cargo check
|
|
working-directory: desktop/src-tauri
|
|
run: cargo check
|
|
|
|
# Remove stale artifacts from the desktop-latest pre-release so that
|
|
# only the current build's files are available for download.
|
|
clean-release:
|
|
needs: [validate]
|
|
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Delete old assets from desktop-latest
|
|
if: "!startsWith(github.ref, 'refs/tags/')"
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
TAG="desktop-latest"
|
|
# List all asset IDs on the release and delete them
|
|
ASSET_IDS=$(gh api "repos/${{ github.repository }}/releases/tags/${TAG}" \
|
|
--jq '.assets[].id' 2>/dev/null || true)
|
|
for id in $ASSET_IDS; do
|
|
echo "Deleting asset $id"
|
|
gh api -X DELETE "repos/${{ github.repository }}/releases/assets/$id" || true
|
|
done
|
|
|
|
build-and-release:
|
|
needs: [validate, clean-release]
|
|
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- platform: ubuntu-22.04
|
|
args: ''
|
|
- platform: macos-14
|
|
args: '--target universal-apple-darwin'
|
|
- platform: windows-latest
|
|
args: ''
|
|
|
|
runs-on: ${{ matrix.platform }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install system dependencies (Linux)
|
|
if: matrix.platform == 'ubuntu-22.04'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libwebkit2gtk-4.1-dev \
|
|
libgtk-3-dev \
|
|
libappindicator3-dev \
|
|
librsvg2-dev \
|
|
patchelf \
|
|
libxdo-dev
|
|
|
|
- name: Install Rust stable
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
targets: ${{ matrix.platform == 'macos-14' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
|
|
|
|
- name: Rust cache
|
|
uses: swatinem/rust-cache@v2
|
|
with:
|
|
workspaces: 'desktop/src-tauri -> target'
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '22'
|
|
|
|
- name: Install frontend dependencies
|
|
working-directory: frontend
|
|
run: npm install
|
|
|
|
- name: Install desktop dependencies
|
|
working-directory: desktop
|
|
run: npm install
|
|
|
|
- name: Download Ollama sidecar
|
|
shell: bash
|
|
run: |
|
|
cd desktop/scripts && chmod +x download-ollama.sh
|
|
if [[ "${{ matrix.platform }}" == "macos-14" ]]; then
|
|
./download-ollama.sh aarch64-apple-darwin
|
|
./download-ollama.sh x86_64-apple-darwin
|
|
else
|
|
./download-ollama.sh
|
|
fi
|
|
|
|
- name: Determine release info
|
|
id: release-info
|
|
shell: bash
|
|
run: |
|
|
if [[ "${{ github.ref }}" == refs/tags/desktop-v* ]]; then
|
|
echo "tag=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
|
|
echo "name=Desktop ${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
|
|
echo "prerelease=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "tag=desktop-latest" >> "$GITHUB_OUTPUT"
|
|
echo "name=Desktop (Latest Build)" >> "$GITHUB_OUTPUT"
|
|
echo "prerelease=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
- name: Configure Apple signing
|
|
if: runner.os == 'macOS'
|
|
env:
|
|
CERT: ${{ secrets.APPLE_CERTIFICATE }}
|
|
CERT_PASS: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
|
SIGN_ID: ${{ secrets.APPLE_SIGNING_IDENTITY }}
|
|
A_ID: ${{ secrets.APPLE_ID }}
|
|
A_PASS: ${{ secrets.APPLE_PASSWORD }}
|
|
A_TEAM: ${{ secrets.APPLE_TEAM_ID }}
|
|
shell: bash
|
|
run: |
|
|
if [ -n "$CERT" ]; then
|
|
echo "APPLE_CERTIFICATE=$CERT" >> "$GITHUB_ENV"
|
|
echo "APPLE_CERTIFICATE_PASSWORD=$CERT_PASS" >> "$GITHUB_ENV"
|
|
echo "APPLE_SIGNING_IDENTITY=$SIGN_ID" >> "$GITHUB_ENV"
|
|
echo "APPLE_ID=$A_ID" >> "$GITHUB_ENV"
|
|
echo "APPLE_PASSWORD=$A_PASS" >> "$GITHUB_ENV"
|
|
echo "APPLE_TEAM_ID=$A_TEAM" >> "$GITHUB_ENV"
|
|
echo "Apple signing configured"
|
|
else
|
|
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
|
|
echo "::error::Apple signing secrets are required for release builds"
|
|
exit 1
|
|
fi
|
|
echo "No Apple certificate configured, skipping code signing"
|
|
fi
|
|
|
|
- name: Build and release
|
|
timeout-minutes: 120
|
|
uses: tauri-apps/tauri-action@v0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
|
TAURI_CONFIG: '{"bundle":{"externalBin":["binaries/ollama"]}}'
|
|
with:
|
|
projectPath: desktop
|
|
tauriScript: npx tauri
|
|
tagName: ${{ steps.release-info.outputs.tag }}
|
|
releaseName: ${{ steps.release-info.outputs.name }}
|
|
releaseBody: 'Desktop application built from ${{ github.sha }}'
|
|
releaseDraft: false
|
|
prerelease: ${{ steps.release-info.outputs.prerelease }}
|
|
includeUpdaterJson: true
|
|
args: ${{ matrix.args }}
|