This commit is contained in:
@@ -89,25 +89,22 @@ jobs:
|
|||||||
|
|
||||||
git commit -m 'Update version to ${{ github.ref_name }}'
|
git commit -m 'Update version to ${{ github.ref_name }}'
|
||||||
if ($LASTEXITCODE -ne 0) {
|
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
|
# The release build runs in detached HEAD on the tag. Resolve the branch
|
||||||
$branch = (git rev-parse --abbrev-ref HEAD).Trim()
|
# that should receive the version bump.
|
||||||
if ($branch -eq 'HEAD' -or [string]::IsNullOrEmpty($branch)) {
|
$branch = '${{ github.event.release.target_commitish }}'
|
||||||
# If target_commitish is a branch, use it; if it's a SHA, find a branch that contains it
|
if ([string]::IsNullOrEmpty($branch) -or $branch -match '^[0-9a-f]{40}$') {
|
||||||
$candidate = '${{ github.event.release.target_commitish }}'
|
$branch = (
|
||||||
if ($candidate -match '^[0-9a-f]{40}$') {
|
git branch -r --contains $env:GITHUB_SHA |
|
||||||
$branch = (
|
ForEach-Object { $_.Trim() } |
|
||||||
git branch -r --contains $env:GITHUB_SHA |
|
Where-Object { $_ -and ($_ -notmatch '->') } |
|
||||||
ForEach-Object { $_.Trim() } |
|
ForEach-Object { $_ -replace '^(?:remotes/)?[^/]+/', '' } |
|
||||||
Where-Object { $_ -and ($_ -notmatch '->') } |
|
Select-Object -First 1
|
||||||
ForEach-Object { $_ -replace '^(?:remotes/)?[^/]+/', '' } |
|
)
|
||||||
Select-Object -First 1
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
$branch = $candidate
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([string]::IsNullOrEmpty($branch)) {
|
if ([string]::IsNullOrEmpty($branch)) {
|
||||||
@@ -116,6 +113,16 @@ jobs:
|
|||||||
exit 1
|
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"
|
git push origin "HEAD:refs/heads/$branch"
|
||||||
|
|
||||||
- name: Build Tauri App
|
- name: Build Tauri App
|
||||||
|
|||||||
Reference in New Issue
Block a user