All checks were successful
Release / Bump version and tag (push) Successful in 3s
Refactored from 2 monolithic workflows into 8 targeted ones: Coordinators (version bump + tag + release creation): - release.yml: bumps app version, tags v*, creates Gitea release - sidecar-release.yml: bumps sidecar version, tags sidecar-v* Per-OS app builds (triggered by v* tags or workflow_dispatch): - build-app-linux.yml: .deb, .rpm, .AppImage - build-app-windows.yml: .msi, -setup.exe - build-app-macos.yml: .dmg Per-OS sidecar builds (triggered by sidecar-v* tags or workflow_dispatch): - build-sidecar-linux.yml: CUDA + CPU variants - build-sidecar-windows.yml: CUDA + CPU variants - build-sidecar-macos.yml: CPU only Each build workflow can be re-triggered independently without re-running the version bump or rebuilding other platforms. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
159 lines
5.5 KiB
YAML
159 lines
5.5 KiB
YAML
name: Build Sidecar (Windows)
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'sidecar-v*'
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Release tag to build (e.g. sidecar-v1.0.3)'
|
|
required: false
|
|
|
|
jobs:
|
|
build-sidecar-windows:
|
|
name: Build Sidecar (Windows)
|
|
runs-on: windows-latest
|
|
env:
|
|
PYTHON_VERSION: "3.11"
|
|
steps:
|
|
- name: Determine tag
|
|
id: tag
|
|
shell: powershell
|
|
run: |
|
|
$inputTag = "${{ github.event.inputs.tag }}"
|
|
$ref = "${{ github.ref }}"
|
|
$refName = "${{ github.ref_name }}"
|
|
|
|
if ($inputTag) {
|
|
$TAG = $inputTag
|
|
} elseif ($ref -like "refs/tags/*") {
|
|
$TAG = $refName
|
|
} else {
|
|
$tags = git ls-remote --tags --sort=-v:refname origin 'refs/tags/sidecar-v*' 2>&1
|
|
$TAG = ($tags | Select-Object -First 1) -replace '.*refs/tags/', ''
|
|
}
|
|
Write-Host "Building for tag: ${TAG}"
|
|
echo "tag=${TAG}" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ steps.tag.outputs.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
|
|
# Add both possible uv install locations to PATH
|
|
$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 (CUDA)
|
|
shell: powershell
|
|
run: |
|
|
uv sync --frozen
|
|
if ($LASTEXITCODE -ne 0) { uv sync }
|
|
uv run pyinstaller local-transcription-headless.spec
|
|
|
|
- name: Package sidecar (CUDA)
|
|
shell: powershell
|
|
run: |
|
|
7z a -tzip -mx=5 sidecar-windows-x86_64-cuda.zip .\dist\local-transcription-backend\*
|
|
|
|
- name: Build sidecar (CPU)
|
|
shell: powershell
|
|
run: |
|
|
Remove-Item -Recurse -Force dist\local-transcription-backend, build -ErrorAction SilentlyContinue
|
|
uv pip install torch torchaudio --index-url https://download.pytorch.org/whl/cpu --force-reinstall
|
|
# Run pyinstaller directly from venv to prevent uv run from
|
|
# re-resolving torch back to the CUDA version via pyproject.toml sources
|
|
.venv\Scripts\pyinstaller.exe local-transcription-headless.spec
|
|
|
|
- name: Package sidecar (CPU)
|
|
shell: powershell
|
|
run: |
|
|
7z a -tzip -mx=5 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 = "${{ steps.tag.outputs.tag }}"
|
|
|
|
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}"
|
|
}
|
|
}
|