Fix CI release upload: support versioned releases on tag pushes
Some checks failed
Build macOS / Build (macOS) (push) Successful in 4m43s
Build Windows / Build (Windows) (push) Successful in 18m20s
Build Linux / Build (Linux) (push) Has been cancelled

- Upload step now runs on both main pushes and v* tag pushes
- Tag pushes create a versioned release (e.g., "Voice to Notes v0.2.0")
- Main pushes update the "latest" prerelease as before
- Windows: filter for *-setup.exe to avoid uploading non-installer binaries

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-21 11:03:00 -07:00
parent a0cb034ab5
commit ec7e364165
3 changed files with 49 additions and 12 deletions

View File

@@ -75,25 +75,38 @@ jobs:
# ── Release ──
- name: Upload to release
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
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" }
# Use version tag for tag pushes, "latest" for main
$REF = "${{ github.ref }}"
if ($REF.StartsWith("refs/tags/")) {
$TAG = $REF.Replace("refs/tags/", "")
$RELEASE_NAME = "Voice to Notes ${TAG}"
$PRERELEASE = $false
} else {
$TAG = "latest"
$RELEASE_NAME = "Voice to Notes (Latest Build)"
$PRERELEASE = $true
}
Write-Host "Release tag: ${TAG}"
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."
name = $RELEASE_NAME
body = "Automated build."
draft = $false
prerelease = $true
prerelease = $PRERELEASE
} | ConvertTo-Json
$release = Invoke-RestMethod -Uri "${REPO_API}/releases" -Method Post -Headers $Headers -ContentType "application/json" -Body $body
$RELEASE_ID = $release.id
@@ -101,7 +114,7 @@ jobs:
Write-Host "Release ID: ${RELEASE_ID}"
Get-ChildItem -Path src-tauri\target\release\bundle -Recurse -Include *.msi,*.exe | ForEach-Object {
Get-ChildItem -Path src-tauri\target\release\bundle -Recurse -Include *.msi,*-setup.exe | ForEach-Object {
$filename = $_.Name
$encodedName = [System.Uri]::EscapeDataString($filename)
$size = [math]::Round($_.Length / 1MB, 1)