diff --git a/.gitea/workflows/gui-version-release.yml b/.gitea/workflows/gui-version-release.yml index 94be626..3dcc319 100644 --- a/.gitea/workflows/gui-version-release.yml +++ b/.gitea/workflows/gui-version-release.yml @@ -515,10 +515,27 @@ jobs: Write-Host ""; Write-Host "Step 5.2: Committing version changes..."; - git commit -m "[skip ci] Update version to v$VERSION" --no-verify; + + # Check if there are changes to commit + $hasUncommitted = git diff --quiet; $diffExitCode1 = $LASTEXITCODE; + $hasStagedChanges = git diff --staged --quiet; $diffExitCode2 = $LASTEXITCODE; + + if (($diffExitCode1 -ne 0) -or ($diffExitCode2 -ne 0)) { + Write-Host "Detected uncommitted changes, creating commit..."; + git commit -m "[skip ci] Update version to v$VERSION" --no-verify; + + if ($LASTEXITCODE -eq 0) { + Write-Host "OK: Commit successful"; + } else { + Write-Host "ERROR: Commit failed"; + } + } else { + Write-Host "No changes to commit (already committed in merge)"; + Write-Host "Skipping commit step"; + $LASTEXITCODE = 0; + } if ($LASTEXITCODE -eq 0) { - Write-Host "OK: Commit successful"; Write-Host ""; Write-Host "Step 5.3: Pushing to remote...";