The TAURI_CONFIG env var approach for resources wasn't being applied by the NSIS bundler, so sidecar.zip was never included in the installer. - Add resources: ["sidecar.zip"] directly to tauri.conf.json - build.rs creates a minimal placeholder zip for dev builds so compilation succeeds even without the real sidecar - Remove TAURI_CONFIG env var from all CI workflows (no longer needed) - Add sidecar.zip to .gitignore (generated by CI, not tracked) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
127 lines
4.3 KiB
YAML
127 lines
4.3 KiB
YAML
name: Build Windows
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
tags: ["v*"]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
env:
|
|
PYTHON_VERSION: "3.11"
|
|
NODE_VERSION: "20"
|
|
TARGET: x86_64-pc-windows-msvc
|
|
|
|
jobs:
|
|
build:
|
|
name: Build (Windows)
|
|
runs-on: windows-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# ── Python sidecar ──
|
|
- name: Install uv
|
|
shell: powershell
|
|
run: |
|
|
if (Get-Command uv -ErrorAction SilentlyContinue) {
|
|
Write-Host "uv already installed: $(uv --version)"
|
|
} else {
|
|
irm https://astral.sh/uv/install.ps1 | iex
|
|
echo "$env:USERPROFILE\.local\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
}
|
|
|
|
- name: Install ffmpeg
|
|
shell: powershell
|
|
run: choco install ffmpeg -y
|
|
|
|
- name: Set up Python
|
|
shell: powershell
|
|
run: uv python install ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Build sidecar
|
|
shell: powershell
|
|
working-directory: python
|
|
run: uv run --python ${{ env.PYTHON_VERSION }} python build_sidecar.py --cpu-only
|
|
|
|
- name: Package sidecar for Tauri
|
|
shell: powershell
|
|
run: |
|
|
Compress-Archive -Path python\dist\voice-to-notes-sidecar\* -DestinationPath src-tauri\sidecar.zip
|
|
|
|
# ── Tauri app ──
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ env.NODE_VERSION }}
|
|
|
|
- name: Install Rust stable
|
|
shell: powershell
|
|
run: |
|
|
if (Get-Command rustup -ErrorAction SilentlyContinue) {
|
|
rustup default stable
|
|
} else {
|
|
Invoke-WebRequest -Uri https://win.rustup.rs/x86_64 -OutFile rustup-init.exe
|
|
.\rustup-init.exe -y --default-toolchain stable
|
|
echo "$env:USERPROFILE\.cargo\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
}
|
|
|
|
- name: Install npm dependencies
|
|
shell: powershell
|
|
run: npm ci
|
|
|
|
- name: Build Tauri app
|
|
shell: powershell
|
|
run: npm run tauri build
|
|
|
|
# ── Release ──
|
|
- name: Upload to release
|
|
if: github.ref == 'refs/heads/main'
|
|
shell: powershell
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
$TAG = "latest"
|
|
$REPO_API = "${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
|
$Headers = @{ "Authorization" = "token $env:BUILD_TOKEN" }
|
|
|
|
try {
|
|
$release = Invoke-RestMethod -Uri "${REPO_API}/releases/tags/${TAG}" -Headers $Headers -ErrorAction Stop
|
|
$RELEASE_ID = $release.id
|
|
} catch {
|
|
$body = @{
|
|
tag_name = $TAG
|
|
name = "Voice to Notes (Latest Build)"
|
|
body = "Latest automated build from main branch."
|
|
draft = $false
|
|
prerelease = $true
|
|
} | ConvertTo-Json
|
|
$release = Invoke-RestMethod -Uri "${REPO_API}/releases" -Method Post -Headers $Headers -ContentType "application/json" -Body $body
|
|
$RELEASE_ID = $release.id
|
|
}
|
|
|
|
Write-Host "Release ID: ${RELEASE_ID}"
|
|
|
|
Get-ChildItem -Path src-tauri\target\release\bundle -Recurse -Include *.msi,*.exe | ForEach-Object {
|
|
$filename = $_.Name
|
|
$encodedName = [System.Uri]::EscapeDataString($filename)
|
|
$size = [math]::Round($_.Length / 1MB, 1)
|
|
Write-Host "Uploading ${filename} (${size} MB)..."
|
|
|
|
try {
|
|
$assets = Invoke-RestMethod -Uri "${REPO_API}/releases/${RELEASE_ID}/assets" -Headers $Headers
|
|
$existing = $assets | Where-Object { $_.name -eq $filename }
|
|
if ($existing) {
|
|
Invoke-RestMethod -Uri "${REPO_API}/releases/${RELEASE_ID}/assets/$($existing.id)" -Method Delete -Headers $Headers
|
|
}
|
|
} catch {}
|
|
|
|
try {
|
|
Invoke-RestMethod -Uri "${REPO_API}/releases/${RELEASE_ID}/assets?name=${encodedName}" `
|
|
-Method Post -Headers $Headers -ContentType "application/octet-stream" `
|
|
-InFile $_.FullName
|
|
Write-Host "Upload successful: ${filename}"
|
|
} catch {
|
|
Write-Host "WARNING: Upload failed for ${filename}: $_"
|
|
}
|
|
}
|