Linux CPU sidecar: PyPI's default torch on Linux includes CUDA (~800MB). UV_NO_SOURCES only bypasses our custom CUDA index but still gets CUDA-enabled torch from PyPI. Now explicitly installs CPU-only torch from pytorch.org/whl/cpu after sync. Same fix applied to Windows. New cleanup-releases.yml workflow (manual trigger): - Configurable: keep N app releases, keep N sidecar releases - Dry run mode (default) shows what would be deleted without deleting - Protects v1.4.0 (last pre-Tauri release) - Shows release sizes in MB Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
136 lines
4.5 KiB
YAML
136 lines
4.5 KiB
YAML
name: Build Sidecar (Windows)
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Sidecar release tag to build (e.g. sidecar-v1.0.3)'
|
|
required: true
|
|
|
|
jobs:
|
|
build-sidecar-windows:
|
|
name: Build Sidecar (Windows)
|
|
runs-on: windows-latest
|
|
env:
|
|
PYTHON_VERSION: "3.11"
|
|
RELEASE_TAG: "${{ inputs.tag }}"
|
|
steps:
|
|
- name: Show tag
|
|
shell: powershell
|
|
run: |
|
|
Write-Host "Building for tag: $env:RELEASE_TAG"
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ inputs.tag }}
|
|
|
|
- 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
|
|
$uvPaths = @(
|
|
"$env:USERPROFILE\.local\bin",
|
|
"$env:USERPROFILE\.cargo\bin",
|
|
"$env:LOCALAPPDATA\uv\bin"
|
|
)
|
|
foreach ($p in $uvPaths) {
|
|
if (Test-Path $p) {
|
|
echo $p | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
|
|
}
|
|
}
|
|
}
|
|
|
|
- name: Set up Python
|
|
shell: powershell
|
|
run: uv python install ${{ env.PYTHON_VERSION }}
|
|
|
|
- name: Install 7-Zip
|
|
shell: powershell
|
|
run: |
|
|
if (-not (Get-Command 7z -ErrorAction SilentlyContinue)) {
|
|
choco install 7zip -y
|
|
}
|
|
|
|
- name: Build sidecar (CPU)
|
|
shell: powershell
|
|
run: |
|
|
$env:UV_NO_SOURCES = "1"
|
|
uv sync
|
|
# PyPI's default torch includes CUDA. Replace with CPU-only.
|
|
uv pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu --force-reinstall
|
|
.venv\Scripts\pyinstaller.exe local-transcription-headless.spec
|
|
|
|
- name: Package sidecar (CPU)
|
|
shell: powershell
|
|
run: |
|
|
7z a -tzip -mx=9 sidecar-windows-x86_64-cpu.zip .\dist\local-transcription-backend\*
|
|
|
|
- name: Upload to sidecar release
|
|
shell: powershell
|
|
env:
|
|
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
|
run: |
|
|
$REPO_API = "${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
|
$Headers = @{ "Authorization" = "token $env:BUILD_TOKEN" }
|
|
$TAG = $env:RELEASE_TAG
|
|
Write-Host "Release tag: $TAG"
|
|
|
|
if (-not $TAG) {
|
|
Write-Host "ERROR: RELEASE_TAG is empty"
|
|
exit 1
|
|
}
|
|
|
|
Write-Host "Waiting for sidecar release $TAG to be available..."
|
|
$RELEASE_ID = $null
|
|
|
|
for ($i = 1; $i -le 30; $i++) {
|
|
try {
|
|
$release = Invoke-RestMethod -Uri "$REPO_API/releases/tags/$TAG" -Headers $Headers -ErrorAction Stop
|
|
$RELEASE_ID = $release.id
|
|
|
|
if ($RELEASE_ID) {
|
|
Write-Host "Found sidecar release: $TAG (ID: $RELEASE_ID)"
|
|
break
|
|
}
|
|
} catch {}
|
|
|
|
Write-Host "Attempt ${i}/30: Release not ready yet, retrying in 10s..."
|
|
Start-Sleep -Seconds 10
|
|
}
|
|
|
|
if (-not $RELEASE_ID) {
|
|
Write-Host "ERROR: Failed to find sidecar release for tag $TAG after 30 attempts."
|
|
exit 1
|
|
}
|
|
|
|
Get-ChildItem -Path . -Filter "sidecar-*.zip" | 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 {}
|
|
|
|
$uploadUrl = "$REPO_API/releases/$RELEASE_ID/assets?name=$encodedName"
|
|
$result = curl.exe --fail --silent --show-error `
|
|
-X POST `
|
|
-H "Authorization: token $env:BUILD_TOKEN" `
|
|
-H "Content-Type: application/octet-stream" `
|
|
-T "$($_.FullName)" `
|
|
"$uploadUrl" 2>&1
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "Upload successful: $filename"
|
|
} else {
|
|
Write-Host "WARNING: Upload failed for ${filename}: $result"
|
|
}
|
|
}
|