From 38f97713c6a69d836f83475b10a8adb286ae468e Mon Sep 17 00:00:00 2001 From: Christoph Brandau Date: Tue, 30 Jun 2026 14:54:06 +0200 Subject: [PATCH] update ci workflow --- .gitea/workflows/app_builder.yaml | 41 ++++++++++++++++++------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/.gitea/workflows/app_builder.yaml b/.gitea/workflows/app_builder.yaml index f9edb64..6aba356 100644 --- a/.gitea/workflows/app_builder.yaml +++ b/.gitea/workflows/app_builder.yaml @@ -89,25 +89,22 @@ jobs: git commit -m 'Update version to ${{ github.ref_name }}' if ($LASTEXITCODE -ne 0) { - Write-Host 'No changes to commit.' + # Version files already match the tag -> nothing to push, succeed quietly. + Write-Host 'No version changes to commit; skipping push.' + exit 0 } - # Get current branch; if detached, resolve to a remote branch that contains this commit - $branch = (git rev-parse --abbrev-ref HEAD).Trim() - if ($branch -eq 'HEAD' -or [string]::IsNullOrEmpty($branch)) { - # If target_commitish is a branch, use it; if it's a SHA, find a branch that contains it - $candidate = '${{ github.event.release.target_commitish }}' - if ($candidate -match '^[0-9a-f]{40}$') { - $branch = ( - git branch -r --contains $env:GITHUB_SHA | - ForEach-Object { $_.Trim() } | - Where-Object { $_ -and ($_ -notmatch '->') } | - ForEach-Object { $_ -replace '^(?:remotes/)?[^/]+/', '' } | - Select-Object -First 1 - ) - } else { - $branch = $candidate - } + # The release build runs in detached HEAD on the tag. Resolve the branch + # that should receive the version bump. + $branch = '${{ github.event.release.target_commitish }}' + if ([string]::IsNullOrEmpty($branch) -or $branch -match '^[0-9a-f]{40}$') { + $branch = ( + git branch -r --contains $env:GITHUB_SHA | + ForEach-Object { $_.Trim() } | + Where-Object { $_ -and ($_ -notmatch '->') } | + ForEach-Object { $_ -replace '^(?:remotes/)?[^/]+/', '' } | + Select-Object -First 1 + ) } if ([string]::IsNullOrEmpty($branch)) { @@ -116,6 +113,16 @@ jobs: exit 1 } + # The tag may be behind the branch tip. Replay the bump commit on top of + # the current remote branch so the push is a clean fast-forward. + git fetch origin $branch + git rebase "origin/$branch" + if ($LASTEXITCODE -ne 0) { + git rebase --abort + Write-Host "Rebase onto origin/$branch failed." + exit 1 + } + git push origin "HEAD:refs/heads/$branch" - name: Build Tauri App