From 3bf88fb55dbe2067bbf44ca0f5a62bacbf58598b Mon Sep 17 00:00:00 2001 From: Shaun Lawrie Date: Tue, 19 Mar 2024 16:58:12 +1300 Subject: [PATCH] Fix build version order --- .github/workflows/build-test-publish.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml index 61883d16..1be99fe9 100644 --- a/.github/workflows/build-test-publish.yml +++ b/.github/workflows/build-test-publish.yml @@ -79,7 +79,11 @@ jobs: $latestStableVersion = $onlineVersions | Where-Object { $_.Version -notlike "*prerelease*" } | Sort-Object -Property Version -Descending | Select-Object -First 1 -ExpandProperty Version $latestStableVersion = [version]$latestStableVersion - $latestPrereleaseVersion = $onlineVersions | Where-Object { $_.Version -like "*prerelease*" } | Sort-Object -Property Version -Descending | Select-Object -First 1 -ExpandProperty Version + $latestPrereleaseVersion = $onlineVersions | Where-Object { $_.Version -like "*prerelease*" } | Sort-Object { + $version = [version]$_.Version.Split("-")[0] + $version = [version]::new($version.Major, $version.Minor, $version.Build, ($_.Version.Split("-")[1] -replace "prerelease", "")) + return $version + } -Descending | Select-Object -First 1 -ExpandProperty Version $latestPrereleaseTag = $latestPrereleaseVersion.Split("-prerelease")[1] # format is like -prerelease6, output here is just 6 $latestPrereleaseVersion = [version]$latestPrereleaseVersion.Split("-prerelease")[0]