Add auto-increment version and release workflow
All checks were successful
Release / Bump version and tag (push) Successful in 3s
All checks were successful
Release / Bump version and tag (push) Successful in 3s
- New release.yml: bumps patch version, commits with skip-ci marker, tags, creates Gitea release - Build workflows now trigger on v* tags only (not branch push) - Simplified upload steps: use tag directly, retry loop for release lookup - Fix macOS: install jq if missing - Sync python/pyproject.toml version to 0.2.0 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,7 @@ name: Build Windows
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
tags: ["v*"]
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: "3.11"
|
||||
@@ -74,7 +72,6 @@ jobs:
|
||||
|
||||
# ── Release ──
|
||||
- name: Upload to release
|
||||
if: github.ref == 'refs/heads/main'
|
||||
shell: powershell
|
||||
env:
|
||||
BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
|
||||
@@ -82,30 +79,31 @@ jobs:
|
||||
$REPO_API = "${{ github.server_url }}/api/v1/repos/${{ github.repository }}"
|
||||
$Headers = @{ "Authorization" = "token $env:BUILD_TOKEN" }
|
||||
|
||||
# Check if the current commit has a version tag
|
||||
$VERSION_TAG = (git tag --points-at HEAD | Select-String '^v').Line
|
||||
if ($VERSION_TAG) {
|
||||
$TAG = $VERSION_TAG
|
||||
$RELEASE_NAME = "Voice to Notes ${TAG}"
|
||||
$PRERELEASE = $false
|
||||
} else {
|
||||
$TAG = "latest"
|
||||
$RELEASE_NAME = "Voice to Notes (Latest Build)"
|
||||
$PRERELEASE = $true
|
||||
}
|
||||
|
||||
$TAG = "${{ github.ref_name }}"
|
||||
$RELEASE_NAME = "Voice to Notes ${TAG}"
|
||||
Write-Host "Release tag: ${TAG}"
|
||||
|
||||
try {
|
||||
$release = Invoke-RestMethod -Uri "${REPO_API}/releases/tags/${TAG}" -Headers $Headers -ErrorAction Stop
|
||||
$RELEASE_ID = $release.id
|
||||
} catch {
|
||||
# Wait for release to be created by the release workflow
|
||||
$RELEASE_ID = $null
|
||||
for ($i = 1; $i -le 5; $i++) {
|
||||
try {
|
||||
$release = Invoke-RestMethod -Uri "${REPO_API}/releases/tags/${TAG}" -Headers $Headers -ErrorAction Stop
|
||||
$RELEASE_ID = $release.id
|
||||
break
|
||||
} catch {
|
||||
Write-Host "Release not found yet, waiting 10s... (attempt $i)"
|
||||
Start-Sleep -Seconds 10
|
||||
}
|
||||
}
|
||||
|
||||
# Fallback: create release if it still doesn't exist
|
||||
if (-not $RELEASE_ID) {
|
||||
$body = @{
|
||||
tag_name = $TAG
|
||||
name = $RELEASE_NAME
|
||||
body = "Automated build."
|
||||
draft = $false
|
||||
prerelease = $PRERELEASE
|
||||
prerelease = $false
|
||||
} | ConvertTo-Json
|
||||
$release = Invoke-RestMethod -Uri "${REPO_API}/releases" -Method Post -Headers $Headers -ContentType "application/json" -Body $body
|
||||
$RELEASE_ID = $release.id
|
||||
|
||||
Reference in New Issue
Block a user