Skip to content

Commit 98fc06b

Browse files
CopilotRomanitho
andcommitted
Fix nightly builds to avoid creating unnecessary prereleases after stable releases
Co-authored-by: Romanitho <96626929+Romanitho@users.noreply.github.com>
1 parent 427b533 commit 98fc06b

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

.github/workflows/GitFlow_Nightly-builds.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,25 @@ jobs:
4747
# Initialize BUILD_NEEDED with default value
4848
$BUILD_NEEDED = $false
4949
50-
# Get the latest release tag to determine release type
51-
$LATEST_TAG = git tag -l --sort=-version:refname | Select-Object -First 1
52-
Write-Host "`n[INFO] Latest release tag: $LATEST_TAG" -ForegroundColor Green
50+
# Get the latest stable release tag (without prerelease suffix)
51+
# Note: We prioritize stable releases over prereleases for comparison
52+
# Git's version sort treats v2.10.0-0 as greater than v2.10.0, which is incorrect
53+
# for our purposes. We want to compare against the latest stable release.
54+
$LATEST_STABLE_TAG = git tag -l --sort=-version:refname | Where-Object { $_ -notlike "*-*" } | Select-Object -First 1
55+
$LATEST_PRERELEASE_TAG = git tag -l --sort=-version:refname | Where-Object { $_ -like "*-*" } | Select-Object -First 1
56+
57+
# Use the latest stable tag as our reference point
58+
# If no stable tag exists, fall back to the latest prerelease
59+
if ($LATEST_STABLE_TAG) {
60+
$LATEST_TAG = $LATEST_STABLE_TAG
61+
Write-Host "`n[INFO] Latest stable release tag: $LATEST_TAG" -ForegroundColor Green
62+
if ($LATEST_PRERELEASE_TAG) {
63+
Write-Host "[INFO] Latest prerelease tag (ignored for comparison): $LATEST_PRERELEASE_TAG" -ForegroundColor DarkGray
64+
}
65+
} else {
66+
$LATEST_TAG = $LATEST_PRERELEASE_TAG
67+
Write-Host "`n[INFO] No stable release found, using latest prerelease: $LATEST_TAG" -ForegroundColor Yellow
68+
}
5369
5470
# Determine release type based on previous tag
5571
if ($LATEST_TAG -like "*-*") {

0 commit comments

Comments
 (0)