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 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user