From ec7e3641658523cfe4e5fa9565020b8c3d904327 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 21 Mar 2026 11:03:00 -0700 Subject: [PATCH] Fix CI release upload: support versioned releases on tag pushes - 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 --- .gitea/workflows/build-linux.yml | 18 +++++++++++++++--- .gitea/workflows/build-macos.yml | 18 +++++++++++++++--- .gitea/workflows/build-windows.yml | 25 +++++++++++++++++++------ 3 files changed, 49 insertions(+), 12 deletions(-) diff --git a/.gitea/workflows/build-linux.yml b/.gitea/workflows/build-linux.yml index 0d30060..ea1671b 100644 --- a/.gitea/workflows/build-linux.yml +++ b/.gitea/workflows/build-linux.yml @@ -66,14 +66,26 @@ jobs: # ── Release ── - name: Upload to release - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') env: BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }} run: | sudo apt-get install -y jq - TAG="latest" REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}" + # Use version tag for tag pushes, "latest" for main + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + TAG="${GITHUB_REF#refs/tags/}" + RELEASE_NAME="Voice to Notes ${TAG}" + PRERELEASE=false + else + TAG="latest" + RELEASE_NAME="Voice to Notes (Latest Build)" + PRERELEASE=true + fi + + echo "Release tag: ${TAG}" + RELEASE_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \ "${REPO_API}/releases/tags/${TAG}" | jq -r '.id // empty') @@ -81,7 +93,7 @@ jobs: RELEASE_ID=$(curl -s -X POST \ -H "Authorization: token ${BUILD_TOKEN}" \ -H "Content-Type: application/json" \ - -d "{\"tag_name\": \"${TAG}\", \"name\": \"Voice to Notes (Latest Build)\", \"body\": \"Latest automated build from main branch.\", \"draft\": false, \"prerelease\": true}" \ + -d "{\"tag_name\": \"${TAG}\", \"name\": \"${RELEASE_NAME}\", \"body\": \"Automated build.\", \"draft\": false, \"prerelease\": ${PRERELEASE}}" \ "${REPO_API}/releases" | jq -r '.id') fi diff --git a/.gitea/workflows/build-macos.yml b/.gitea/workflows/build-macos.yml index 7447a3f..1324d69 100644 --- a/.gitea/workflows/build-macos.yml +++ b/.gitea/workflows/build-macos.yml @@ -65,13 +65,25 @@ jobs: # ── Release ── - name: Upload to release - if: github.ref == 'refs/heads/main' + if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') env: BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }} run: | - TAG="latest" REPO_API="${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}" + # Use version tag for tag pushes, "latest" for main + if [[ "${GITHUB_REF}" == refs/tags/* ]]; then + TAG="${GITHUB_REF#refs/tags/}" + RELEASE_NAME="Voice to Notes ${TAG}" + PRERELEASE=false + else + TAG="latest" + RELEASE_NAME="Voice to Notes (Latest Build)" + PRERELEASE=true + fi + + echo "Release tag: ${TAG}" + RELEASE_ID=$(curl -s -H "Authorization: token ${BUILD_TOKEN}" \ "${REPO_API}/releases/tags/${TAG}" | jq -r '.id // empty') @@ -79,7 +91,7 @@ jobs: RELEASE_ID=$(curl -s -X POST \ -H "Authorization: token ${BUILD_TOKEN}" \ -H "Content-Type: application/json" \ - -d "{\"tag_name\": \"${TAG}\", \"name\": \"Voice to Notes (Latest Build)\", \"body\": \"Latest automated build from main branch.\", \"draft\": false, \"prerelease\": true}" \ + -d "{\"tag_name\": \"${TAG}\", \"name\": \"${RELEASE_NAME}\", \"body\": \"Automated build.\", \"draft\": false, \"prerelease\": ${PRERELEASE}}" \ "${REPO_API}/releases" | jq -r '.id') fi diff --git a/.gitea/workflows/build-windows.yml b/.gitea/workflows/build-windows.yml index aa0fca0..76decac 100644 --- a/.gitea/workflows/build-windows.yml +++ b/.gitea/workflows/build-windows.yml @@ -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)