Skip to content

Add full distribution packaging to CI workflow #3

Add full distribution packaging to CI workflow

Add full distribution packaging to CI workflow #3

Workflow file for this run

name: Build Release
on:
push:
tags:
- "v*"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
rust_target: aarch64-apple-darwin
ort_arch: osx-arm64
dist_name: orunla-mac-aarch64
- platform: macos-15-intel
rust_target: x86_64-apple-darwin
ort_arch: osx-x86_64
dist_name: orunla-mac-x86_64
- platform: windows-latest
rust_target: x86_64-pc-windows-msvc
ort_arch: win-x64
dist_name: orunla-windows
runs-on: ${{ matrix.platform }}
env:
ORT_VERSION: "1.20.0"
steps:
- name: Checkout
uses: actions/checkout@v4
# Windows: fix broken MSVC link.exe path (actions/runner-images#12432)
- name: Configure lld-link for Windows
if: runner.os == 'Windows'
shell: bash
run: |
mkdir -p src-tauri/.cargo
cat > src-tauri/.cargo/config.toml << 'EOF'
[target.x86_64-pc-windows-msvc]
linker = "lld-link"
EOF
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"
- name: Install npm dependencies
run: npm ci
# ── Download ONNX Runtime ──────────────────────────────────────────
- name: Download ONNX Runtime (macOS)
if: runner.os == 'macOS'
run: |
ORT_ARCHIVE="onnxruntime-${{ matrix.ort_arch }}-${ORT_VERSION}.tgz"
ORT_URL="https://github.com/microsoft/onnxruntime/releases/download/v${ORT_VERSION}/${ORT_ARCHIVE}"
echo "Downloading ONNX Runtime from ${ORT_URL}..."
curl -sL "${ORT_URL}" -o "${ORT_ARCHIVE}"
tar xzf "${ORT_ARCHIVE}"
mkdir -p src-tauri/resources
cp "onnxruntime-${{ matrix.ort_arch }}-${ORT_VERSION}/lib/libonnxruntime.${ORT_VERSION}.dylib" \
src-tauri/resources/libonnxruntime.dylib
ls -la src-tauri/resources/
- name: Download ONNX Runtime (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ORT_ARCHIVE = "onnxruntime-${{ matrix.ort_arch }}-${{ env.ORT_VERSION }}.zip"
$ORT_URL = "https://github.com/microsoft/onnxruntime/releases/download/v${{ env.ORT_VERSION }}/$ORT_ARCHIVE"
Write-Host "Downloading ONNX Runtime from $ORT_URL..."
Invoke-WebRequest -Uri $ORT_URL -OutFile $ORT_ARCHIVE
Expand-Archive -Path $ORT_ARCHIVE -DestinationPath "ort-extract"
New-Item -ItemType Directory -Force -Path "src-tauri\resources" | Out-Null
Copy-Item "ort-extract\onnxruntime-${{ matrix.ort_arch }}-${{ env.ORT_VERSION }}\lib\onnxruntime.dll" `
"src-tauri\resources\onnxruntime.dll"
Get-ChildItem "src-tauri\resources\"
# macOS: patch tauri.conf.json to reference dylib instead of dll
- name: Patch tauri.conf.json for macOS
if: runner.os == 'macOS'
run: |
sed -i '' 's|resources/onnxruntime.dll|resources/libonnxruntime.dylib|' src-tauri/tauri.conf.json
# ── Build Tauri desktop app ────────────────────────────────────────
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: "Orunla ${{ github.ref_name }}"
releaseBody: |
Orunla Memory System release.
**macOS Apple Silicon (M1-M4):** Download `orunla-mac-aarch64.zip`
**macOS Intel:** Download `orunla-mac-x86_64.zip`
**Windows:** Download `orunla-windows.zip`
Each zip contains the desktop app, CLI, MCP server, ONNX runtime, and documentation.
> macOS unsigned build: Right-click the app → Open to bypass Gatekeeper on first launch.
releaseDraft: true
prerelease: false
args: --target ${{ matrix.rust_target }}
# ── Build CLI and MCP binaries ─────────────────────────────────────
- name: Build CLI and MCP binaries
run: |
cargo build --release --target ${{ matrix.rust_target }} --bin orunla_cli
cargo build --release --target ${{ matrix.rust_target }} --bin orunla_mcp
# ── Package full distribution zip ──────────────────────────────────
- name: Package distribution (macOS)
if: runner.os == 'macOS'
run: |
DIST="${{ matrix.dist_name }}"
mkdir -p "${DIST}/documentation"
# Binaries
cp "target/${{ matrix.rust_target }}/release/orunla_cli" "${DIST}/"
cp "target/${{ matrix.rust_target }}/release/orunla_mcp" "${DIST}/"
# ONNX Runtime
cp "src-tauri/resources/libonnxruntime.dylib" "${DIST}/"
# Browser UI
cp launch_orunla.sh "${DIST}/"
chmod +x "${DIST}/launch_orunla.sh"
mkdir -p "${DIST}/ui"
cp ui/index.html "${DIST}/ui/"
cp ui/main.js "${DIST}/ui/"
# Documentation
cp README-MAC.md "${DIST}/README.md"
cp docs/CLI.md "${DIST}/documentation/" 2>/dev/null || true
cp docs/MCP.md "${DIST}/documentation/" 2>/dev/null || true
cp API_REFERENCE.md "${DIST}/documentation/" 2>/dev/null || true
cp OVERVIEW.md "${DIST}/documentation/" 2>/dev/null || true
cp LICENSE "${DIST}/documentation/" 2>/dev/null || true
cp THIRD_PARTY_NOTICES.md "${DIST}/documentation/" 2>/dev/null || true
# Zip
zip -r "${DIST}.zip" "${DIST}/"
echo "Packaged ${DIST}.zip:"
ls -la "${DIST}.zip"
- name: Package distribution (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$DIST = "${{ matrix.dist_name }}"
New-Item -ItemType Directory -Force -Path "$DIST\documentation" | Out-Null
# Binaries
Copy-Item "target\${{ matrix.rust_target }}\release\orunla_cli.exe" "$DIST\"
Copy-Item "target\${{ matrix.rust_target }}\release\orunla_mcp.exe" "$DIST\"
# Desktop app (built by tauri-action)
$tauriExe = Get-ChildItem -Path "src-tauri\target\${{ matrix.rust_target }}\release" -Filter "*.exe" |
Where-Object { $_.Name -eq "app.exe" -or $_.Name -eq "Orunla.exe" } |
Select-Object -First 1
if ($tauriExe) {
Copy-Item $tauriExe.FullName "$DIST\Orunla.exe"
}
# ONNX Runtime
Copy-Item "src-tauri\resources\onnxruntime.dll" "$DIST\"
# Documentation
Copy-Item "README-WINDOWS.md" "$DIST\README.md"
$docs = @("docs\CLI.md", "docs\MCP.md", "API_REFERENCE.md", "OVERVIEW.md", "LICENSE", "THIRD_PARTY_NOTICES.md")
foreach ($doc in $docs) {
if (Test-Path $doc) { Copy-Item $doc "$DIST\documentation\" }
}
# Zip
Compress-Archive -Path "$DIST\*" -DestinationPath "$DIST.zip" -Force
Write-Host "Packaged ${DIST}.zip:"
Get-ChildItem "$DIST.zip"
# Upload dist zip to the release
- name: Upload distribution zip
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
TAG="${{ github.ref_name }}"
# workflow_dispatch may not have a tag, use a default
if [ -z "$TAG" ] || [ "$TAG" = "" ]; then
TAG="v0.1.1"
fi
gh release upload "$TAG" "${{ matrix.dist_name }}.zip" --clobber