From 03ac81adcd6ded1cec60c9096de85796721be2f1 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 24 Jan 2025 09:58:10 +0100 Subject: [PATCH 1/8] feat: support proper sorting for prereleases --- updater/scripts/sort-versions.ps1 | 31 ++++--------------------------- updater/tests/sort-versions.ps1 | 10 +++++----- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/updater/scripts/sort-versions.ps1 b/updater/scripts/sort-versions.ps1 index 1b2248c..19eef81 100644 --- a/updater/scripts/sort-versions.ps1 +++ b/updater/scripts/sort-versions.ps1 @@ -4,37 +4,14 @@ param( Set-StrictMode -Version latest -function GetComparablePart([Parameter(Mandatory = $true)][string] $value) -{ - $value.PadLeft(10, '0') -} - function GetComparableVersion([Parameter(Mandatory = $true)][string] $value) { $value = $value -replace '^v', '' - $output = '' - $buffer = '' - for ($i = 0; $i -lt $value.Length; $i++) - { - $char = $value[$i] - if ("$char" -match '[^a-zA-Z0-9]') - { - # Found a separtor, update the current buffer - $output += GetComparablePart $buffer - $output += $char - $buffer = '' - } - else - { - $buffer += $char - } + try { + [System.Management.Automation.SemanticVersion]::Parse($value) + } catch { + Write-Error "Failed to parse semantic version '$value': $_" } - if ($buffer.Length -gt 0) - { - $output += GetComparablePart $buffer - } - - $output } $List | Sort-Object -Property @{Expression = { GetComparableVersion $_ } } diff --git a/updater/tests/sort-versions.ps1 b/updater/tests/sort-versions.ps1 index f4cc31e..b7cf5e6 100644 --- a/updater/tests/sort-versions.ps1 +++ b/updater/tests/sort-versions.ps1 @@ -20,8 +20,8 @@ RunTest "sort standard versions v2" { AssertEqual @('v1.2.3', '3.0.0', '5.4.1', '5.4.11', '5.5', 'v6.0') $sorted } -# TODO, currently doesn't respect (order) stuff like RC, Beta, etc. -# RunTest "sort with pre-releases" { -# $sorted = SortVersions @('3.0.0', '5.4.11', 'v1.2.3', '5.4.1', '5.4.11-rc.0') -# AssertEqual @('v1.2.3', '3.0.0', '5.4.1', '5.4.11-rc.0', '5.4.11') $sorted -# } +# https://semver.org/#spec-item-11 +RunTest "sort with pre-releases" { + $sorted = SortVersions @('1.0.0-rc.1', '1.0.0', '1.0.0-beta.11', '1.0.0-alpha.1', '1.0.0-beta', '1.0.0-alpha.beta', '1.0.0-alpha', '1.0.0-beta.2') + AssertEqual @('1.0.0-alpha', '1.0.0-alpha.1', '1.0.0-alpha.beta', '1.0.0-beta', '1.0.0-beta.2', '1.0.0-beta.11', '1.0.0-rc.1', '1.0.0') $sorted +} From 4e88dc4fb3886b9ff4264d5c480cfa6c973b4418 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 24 Jan 2025 09:59:03 +0100 Subject: [PATCH 2/8] chore: changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcd7e86..8f52b18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Unreleased + +### Fixes + +- Fix sorting prerelease versions ([#78](https://github.com/getsentry/github-workflows/pull/78)) + ## 2.11.0 ### Features From 24913b1185e6c2039df88970baab1e5a5552e4b6 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 24 Jan 2025 10:12:53 +0100 Subject: [PATCH 3/8] don't fail on tags that fail to parse as semver --- updater/scripts/sort-versions.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/updater/scripts/sort-versions.ps1 b/updater/scripts/sort-versions.ps1 index 19eef81..d088662 100644 --- a/updater/scripts/sort-versions.ps1 +++ b/updater/scripts/sort-versions.ps1 @@ -10,8 +10,11 @@ function GetComparableVersion([Parameter(Mandatory = $true)][string] $value) try { [System.Management.Automation.SemanticVersion]::Parse($value) } catch { - Write-Error "Failed to parse semantic version '$value': $_" + Write-Warning "Failed to parse semantic version '$value': $_" + $null } } -$List | Sort-Object -Property @{Expression = { GetComparableVersion $_ } } +$List ` + | Where-Object { $null -ne (GetComparableVersion $_) } ` + | Sort-Object -Property @{Expression = { GetComparableVersion $_ } } From 8e55514159386cc5e26813d3e8076a6316c589ae Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 24 Jan 2025 10:53:57 +0100 Subject: [PATCH 4/8] skip updates if not updating to the actual latest version --- updater/scripts/update-dependency.ps1 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/updater/scripts/update-dependency.ps1 b/updater/scripts/update-dependency.ps1 index bfa0ba4..bdd38f8 100644 --- a/updater/scripts/update-dependency.ps1 +++ b/updater/scripts/update-dependency.ps1 @@ -167,6 +167,30 @@ if ("$Tag" -eq "") { return } + + # It's possible that the dependency was updated to a pre-release version manually in which case we don't want to + # roll back, even though it's not the latest version matching the configured pattern. + try { + if ([System.Management.Automation.SemanticVersion]::Parse(($originalTag -replace '^v', '')) ` + -ge [System.Management.Automation.SemanticVersion]::Parse(($latestTag -replace '^v', ''))) + { + Write-Host "SemVer represented by the original tag '$originalTag' is newer than the latest tag '$latestTag'. Skipping update." + return + } + } catch { + Write-Warning "Failed to parse semantic version '$value': $_" + } + + # Verify that the latest tag actually points to a different commit. Otherwise, we don't need to update. + $refs = $(git ls-remote --tags $url) + $refOriginal = (($refs -match "refs/tags/$originalTag" ) -split "[ \t]") | Select-Object -First 1 + $refLatest = (($refs -match "refs/tags/$latestTag" ) -split "[ \t]") | Select-Object -First 1 + if ($refOriginal -eq $refLatest) + { + Write-Host "Latest tag '$latestTag' points to the same commit as the original tag '$originalTag'. Skipping update." + return + } + $Tag = $latestTag } From 9b563913abd2d319f35cc6ec47b77d8f23a2d69e Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 24 Jan 2025 11:01:42 +0100 Subject: [PATCH 5/8] fixes --- updater/scripts/common.ps1 | 11 +++++++++++ updater/scripts/sort-versions.ps1 | 12 +----------- updater/scripts/update-dependency.ps1 | 14 +++++--------- 3 files changed, 17 insertions(+), 20 deletions(-) create mode 100644 updater/scripts/common.ps1 diff --git a/updater/scripts/common.ps1 b/updater/scripts/common.ps1 new file mode 100644 index 0000000..134f192 --- /dev/null +++ b/updater/scripts/common.ps1 @@ -0,0 +1,11 @@ + +function GetComparableVersion([Parameter(Mandatory = $true)][string] $value) +{ + $value = $value -replace '^v', '' + try { + [System.Management.Automation.SemanticVersion]::Parse($value) + } catch { + Write-Warning "Failed to parse string '$value' as semantic version: $_" + $null + } +} diff --git a/updater/scripts/sort-versions.ps1 b/updater/scripts/sort-versions.ps1 index d088662..0c23c00 100644 --- a/updater/scripts/sort-versions.ps1 +++ b/updater/scripts/sort-versions.ps1 @@ -3,17 +3,7 @@ param( ) Set-StrictMode -Version latest - -function GetComparableVersion([Parameter(Mandatory = $true)][string] $value) -{ - $value = $value -replace '^v', '' - try { - [System.Management.Automation.SemanticVersion]::Parse($value) - } catch { - Write-Warning "Failed to parse semantic version '$value': $_" - $null - } -} +. "$PSScriptRoot/common.ps1" $List ` | Where-Object { $null -ne (GetComparableVersion $_) } ` diff --git a/updater/scripts/update-dependency.ps1 b/updater/scripts/update-dependency.ps1 index bdd38f8..e133835 100644 --- a/updater/scripts/update-dependency.ps1 +++ b/updater/scripts/update-dependency.ps1 @@ -14,6 +14,7 @@ param( ) Set-StrictMode -Version latest +. "$PSScriptRoot/common.ps1" if (-not (Test-Path $Path )) { @@ -170,15 +171,10 @@ if ("$Tag" -eq "") # It's possible that the dependency was updated to a pre-release version manually in which case we don't want to # roll back, even though it's not the latest version matching the configured pattern. - try { - if ([System.Management.Automation.SemanticVersion]::Parse(($originalTag -replace '^v', '')) ` - -ge [System.Management.Automation.SemanticVersion]::Parse(($latestTag -replace '^v', ''))) - { - Write-Host "SemVer represented by the original tag '$originalTag' is newer than the latest tag '$latestTag'. Skipping update." - return - } - } catch { - Write-Warning "Failed to parse semantic version '$value': $_" + if ((GetComparableVersion $originalTag) -ge (GetComparableVersion $latestTag)) + { + Write-Host "SemVer represented by the original tag '$originalTag' is newer than the latest tag '$latestTag'. Skipping update." + return } # Verify that the latest tag actually points to a different commit. Otherwise, we don't need to update. From fdc292f5733416374fd7ef7024e0cf56d283f2c8 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 24 Jan 2025 11:10:08 +0100 Subject: [PATCH 6/8] more fixes --- updater/scripts/common.ps1 | 2 +- updater/scripts/update-dependency.ps1 | 64 ++++++++++++++------------- 2 files changed, 35 insertions(+), 31 deletions(-) diff --git a/updater/scripts/common.ps1 b/updater/scripts/common.ps1 index 134f192..d248721 100644 --- a/updater/scripts/common.ps1 +++ b/updater/scripts/common.ps1 @@ -1,5 +1,5 @@ -function GetComparableVersion([Parameter(Mandatory = $true)][string] $value) +function GetComparableVersion([string] $value) { $value = $value -replace '^v', '' try { diff --git a/updater/scripts/update-dependency.ps1 b/updater/scripts/update-dependency.ps1 index e133835..b2b9110 100644 --- a/updater/scripts/update-dependency.ps1 +++ b/updater/scripts/update-dependency.ps1 @@ -46,8 +46,9 @@ if (-not $isSubmodule) if (Get-Command 'chmod' -ErrorAction SilentlyContinue) { chmod +x $Path - if ($LastExitCode -ne 0) { - throw "chmod failed"; + if ($LastExitCode -ne 0) + { + throw 'chmod failed'; } } try @@ -70,18 +71,18 @@ if (-not $isSubmodule) { switch ($action) { - "get-version" + 'get-version' { return (Get-Content $Path -Raw | ConvertFrom-StringData).version } - "get-repo" + 'get-repo' { return (Get-Content $Path -Raw | ConvertFrom-StringData).repo } - "set-version" + 'set-version' { $content = Get-Content $Path - $content = $content -replace "^(?version *= *).*$", "`${prop}$value" + $content = $content -replace '^(?version *= *).*$', "`${prop}$value" $content | Out-File $Path $readVersion = (Get-Content $Path -Raw | ConvertFrom-StringData).version @@ -100,7 +101,7 @@ if (-not $isSubmodule) } } -if ("$Tag" -eq "") +if ("$Tag" -eq '') { if ($isSubmodule) { @@ -112,7 +113,7 @@ if ("$Tag" -eq "") git fetch --tags [string[]]$tags = $(git tag --list) $url = $(git remote get-url origin) - $mainBranch = $(git remote show origin | Select-String "HEAD branch: (.*)").Matches[0].Groups[1].Value + $mainBranch = $(git remote show origin | Select-String 'HEAD branch: (.*)').Matches[0].Groups[1].Value } finally { @@ -126,9 +127,9 @@ if ("$Tag" -eq "") # Get tags for a repo without cloning. [string[]]$tags = $(git ls-remote --refs --tags $url) - $tags = $tags | ForEach-Object { ($_ -split "\s+")[1] -replace '^refs/tags/', '' } + $tags = $tags | ForEach-Object { ($_ -split '\s+')[1] -replace '^refs/tags/', '' } - $headRef = ($(git ls-remote $url HEAD) -split "\s+")[0] + $headRef = ($(git ls-remote $url HEAD) -split '\s+')[0] if ("$headRef" -eq '') { throw "Couldn't determine repository head (no ref returned by ls-remote HEAD" @@ -156,35 +157,38 @@ if ("$Tag" -eq "") Write-Host "Sorted tags: $tags" $latestTag = $tags[-1] - $latestTagNice = ($latestTag -match "^[0-9]") ? "v$latestTag" : $latestTag + $latestTagNice = ($latestTag -match '^[0-9]') ? "v$latestTag" : $latestTag - SetOutput "originalTag" $originalTag - SetOutput "latestTag" $latestTag - SetOutput "latestTagNice" $latestTagNice - SetOutput "url" $url - SetOutput "mainBranch" $mainBranch + SetOutput 'originalTag' $originalTag + SetOutput 'latestTag' $latestTag + SetOutput 'latestTagNice' $latestTagNice + SetOutput 'url' $url + SetOutput 'mainBranch' $mainBranch if ("$originalTag" -eq "$latestTag") { return } - # It's possible that the dependency was updated to a pre-release version manually in which case we don't want to - # roll back, even though it's not the latest version matching the configured pattern. - if ((GetComparableVersion $originalTag) -ge (GetComparableVersion $latestTag)) + if (("$originalTag" -ne '') -and ("$latestTag" -ne '')) { - Write-Host "SemVer represented by the original tag '$originalTag' is newer than the latest tag '$latestTag'. Skipping update." - return - } + # It's possible that the dependency was updated to a pre-release version manually in which case we don't want to + # roll back, even though it's not the latest version matching the configured pattern. + if ((GetComparableVersion $originalTag) -ge (GetComparableVersion $latestTag)) + { + Write-Host "SemVer represented by the original tag '$originalTag' is newer than the latest tag '$latestTag'. Skipping update." + return + } - # Verify that the latest tag actually points to a different commit. Otherwise, we don't need to update. - $refs = $(git ls-remote --tags $url) - $refOriginal = (($refs -match "refs/tags/$originalTag" ) -split "[ \t]") | Select-Object -First 1 - $refLatest = (($refs -match "refs/tags/$latestTag" ) -split "[ \t]") | Select-Object -First 1 - if ($refOriginal -eq $refLatest) - { - Write-Host "Latest tag '$latestTag' points to the same commit as the original tag '$originalTag'. Skipping update." - return + # Verify that the latest tag actually points to a different commit. Otherwise, we don't need to update. + $refs = $(git ls-remote --tags $url) + $refOriginal = (($refs -match "refs/tags/$originalTag" ) -split '[ \t]') | Select-Object -First 1 + $refLatest = (($refs -match "refs/tags/$latestTag" ) -split '[ \t]') | Select-Object -First 1 + if ($refOriginal -eq $refLatest) + { + Write-Host "Latest tag '$latestTag' points to the same commit as the original tag '$originalTag'. Skipping update." + return + } } $Tag = $latestTag From e211f8e2e5fe9516b1c564d786b3afe5760d89e8 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 24 Jan 2025 11:16:18 +0100 Subject: [PATCH 7/8] tests and other fixes --- updater/scripts/update-dependency.ps1 | 48 ++++++++++--------- updater/tests/update-dependency.ps1 | 68 +++++++++++++++------------ 2 files changed, 65 insertions(+), 51 deletions(-) diff --git a/updater/scripts/update-dependency.ps1 b/updater/scripts/update-dependency.ps1 index b2b9110..c9af07b 100644 --- a/updater/scripts/update-dependency.ps1 +++ b/updater/scripts/update-dependency.ps1 @@ -157,6 +157,33 @@ if ("$Tag" -eq '') Write-Host "Sorted tags: $tags" $latestTag = $tags[-1] + + if (("$originalTag" -ne '') -and ("$latestTag" -ne '') -and ("$latestTag" -ne "$originalTag")) + { + do + { + # It's possible that the dependency was updated to a pre-release version manually in which case we don't want to + # roll back, even though it's not the latest version matching the configured pattern. + if ((GetComparableVersion $originalTag) -ge (GetComparableVersion $latestTag)) + { + Write-Host "SemVer represented by the original tag '$originalTag' is newer than the latest tag '$latestTag'. Skipping update." + $latestTag = $originalTag + break + } + + # Verify that the latest tag actually points to a different commit. Otherwise, we don't need to update. + $refs = $(git ls-remote --tags $url) + $refOriginal = (($refs -match "refs/tags/$originalTag" ) -split '[ \t]') | Select-Object -First 1 + $refLatest = (($refs -match "refs/tags/$latestTag" ) -split '[ \t]') | Select-Object -First 1 + if ($refOriginal -eq $refLatest) + { + Write-Host "Latest tag '$latestTag' points to the same commit as the original tag '$originalTag'. Skipping update." + $latestTag = $originalTag + break + } + } while ($false) + } + $latestTagNice = ($latestTag -match '^[0-9]') ? "v$latestTag" : $latestTag SetOutput 'originalTag' $originalTag @@ -170,27 +197,6 @@ if ("$Tag" -eq '') return } - if (("$originalTag" -ne '') -and ("$latestTag" -ne '')) - { - # It's possible that the dependency was updated to a pre-release version manually in which case we don't want to - # roll back, even though it's not the latest version matching the configured pattern. - if ((GetComparableVersion $originalTag) -ge (GetComparableVersion $latestTag)) - { - Write-Host "SemVer represented by the original tag '$originalTag' is newer than the latest tag '$latestTag'. Skipping update." - return - } - - # Verify that the latest tag actually points to a different commit. Otherwise, we don't need to update. - $refs = $(git ls-remote --tags $url) - $refOriginal = (($refs -match "refs/tags/$originalTag" ) -split '[ \t]') | Select-Object -First 1 - $refLatest = (($refs -match "refs/tags/$latestTag" ) -split '[ \t]') | Select-Object -First 1 - if ($refOriginal -eq $refLatest) - { - Write-Host "Latest tag '$latestTag' points to the same commit as the original tag '$originalTag'. Skipping update." - return - } - } - $Tag = $latestTag } diff --git a/updater/tests/update-dependency.ps1 b/updater/tests/update-dependency.ps1 index 9a6eb1f..4fed6af 100644 --- a/updater/tests/update-dependency.ps1 +++ b/updater/tests/update-dependency.ps1 @@ -23,19 +23,19 @@ $repoUrl = 'https://github.com/getsentry/github-workflows' $currentVersion = (git -c 'versionsort.suffix=-' ls-remote --tags --sort='v:refname' $repoUrl ` | Select-Object -Last 1 | Select-String -Pattern 'refs/tags/(.*)$').Matches.Groups[1].Value -RunTest "properties-file" { +RunTest 'properties-file' { $testFile = "$testDir/test.properties" - @("repo=$repoUrl", "version = none") | Out-File $testFile + @("repo=$repoUrl", 'version = none') | Out-File $testFile UpdateDependency $testFile AssertEqual @("repo=$repoUrl", "version = $currentVersion") (Get-Content $testFile) } -RunTest "version pattern match" { +RunTest 'version pattern match' { $testFile = "$testDir/test.properties" $repo = 'https://github.com/getsentry/sentry-cli' - @("repo=$repo", "version=0") | Out-File $testFile + @("repo=$repo", 'version=0') | Out-File $testFile UpdateDependency $testFile '^0\.' - AssertEqual @("repo=$repo", "version=0.28.0") (Get-Content $testFile) + AssertEqual @("repo=$repo", 'version=0.28.0') (Get-Content $testFile) } function _testOutput([string[]] $output) @@ -48,27 +48,27 @@ function _testOutput([string[]] $output) AssertContains $output 'mainBranch=master' } -RunTest "writes output" { +RunTest 'writes output' { $testFile = "$testDir/test.properties" $repo = 'https://github.com/getsentry/sentry-cli' - @("repo=$repo", "version=0") | Out-File $testFile + @("repo=$repo", 'version=0') | Out-File $testFile $stdout = UpdateDependency $testFile '^0\.' _testOutput $stdout } -RunTest "writes to env:GITHUB_OUTPUT" { +RunTest 'writes to env:GITHUB_OUTPUT' { $testFile = "$testDir/test.properties" $repo = 'https://github.com/getsentry/sentry-cli' - @("repo=$repo", "version=0") | Out-File $testFile + @("repo=$repo", 'version=0') | Out-File $testFile $outFile = "$testDir/outfile" New-Item $outFile -ItemType File | Out-Null try { $env:GITHUB_OUTPUT = $outFile $stdout = UpdateDependency $testFile '^0\.' - Write-Host "Testing standard output" + Write-Host 'Testing standard output' _testOutput $stdout - Write-Host "Testing env:GITHUB_OUTPUT" + Write-Host 'Testing env:GITHUB_OUTPUT' _testOutput (Get-Content $outFile) } finally @@ -80,15 +80,23 @@ RunTest "writes to env:GITHUB_OUTPUT" { } # Note: without custom sorting, this would have yielded 'v1.7.31_gradle_plugin' -RunTest "version sorting must work properly" { +RunTest 'version sorting must work properly' { $testFile = "$testDir/test.properties" $repo = 'https://github.com/getsentry/sentry-java' - @("repo=$repo", "version=0") | Out-File $testFile + @("repo=$repo", 'version=0') | Out-File $testFile UpdateDependency $testFile '^v?[123].*$' - AssertEqual @("repo=$repo", "version=3.2.1") (Get-Content $testFile) + AssertEqual @("repo=$repo", 'version=3.2.1') (Get-Content $testFile) } -RunTest "powershell-script" { +RunTest 'will not update from a later release to an earlier release' { + $testFile = "$testDir/test.properties" + $repo = 'https://github.com/getsentry/sentry-java' + @("repo=$repo", 'version=999.0.0-beta.1') | Out-File $testFile + UpdateDependency $testFile + AssertEqual @("repo=$repo", 'version=999.0.0-beta.1') (Get-Content $testFile) +} + +RunTest 'powershell-script' { $testFile = "$testDir/test.version" '' | Out-File $testFile $testScript = "$testDir/test.ps1" @@ -109,7 +117,7 @@ switch ($action) AssertEqual $currentVersion (Get-Content $testFile) } -RunTest "bash-script" { +RunTest 'bash-script' { $testFile = "$testDir/test.version" '' | Out-File $testFile $testScript = "$testDir/test.sh" @@ -136,18 +144,18 @@ esac '@ | Out-File $testScript UpdateDependency $testScript AssertEqual $currentVersion (Get-Content $testFile) -} -skipReason ($IsWindows ? "on Windows" : '') +} -skipReason ($IsWindows ? 'on Windows' : '') -RunTest "powershell-script fails in get-version" { +RunTest 'powershell-script fails in get-version' { $testScript = "$testDir/test.ps1" @' throw "Failure" '@ | Out-File $testScript - AssertFailsWith "get-version | output: Failure" { UpdateDependency $testScript } + AssertFailsWith 'get-version | output: Failure' { UpdateDependency $testScript } } -RunTest "bash-script fails in get-version" { +RunTest 'bash-script fails in get-version' { $testScript = "$testDir/test.sh" @' #!/usr/bin/env bash @@ -155,10 +163,10 @@ echo "Failure" exit 1 '@ | Out-File $testScript - AssertFailsWith "get-version | output: Failure" { UpdateDependency $testScript } -} -skipReason ($IsWindows ? "on Windows" : '') + AssertFailsWith 'get-version | output: Failure' { UpdateDependency $testScript } +} -skipReason ($IsWindows ? 'on Windows' : '') -RunTest "powershell-script fails in get-repo" { +RunTest 'powershell-script fails in get-repo' { $testScript = "$testDir/test.ps1" @' param([string] $action, [string] $value) @@ -168,10 +176,10 @@ if ($action -eq "get-repo") } '@ | Out-File $testScript - AssertFailsWith "get-repo | output: Failure" { UpdateDependency $testScript } + AssertFailsWith 'get-repo | output: Failure' { UpdateDependency $testScript } } -RunTest "bash-script fails in get-repo" { +RunTest 'bash-script fails in get-repo' { $testScript = "$testDir/test.sh" @' #!/usr/bin/env bash @@ -186,10 +194,10 @@ get-repo) esac '@ | Out-File $testScript - AssertFailsWith "get-repo | output: Failure" { UpdateDependency $testScript } -} -skipReason ($IsWindows ? "on Windows" : '') + AssertFailsWith 'get-repo | output: Failure' { UpdateDependency $testScript } +} -skipReason ($IsWindows ? 'on Windows' : '') -RunTest "powershell-script fails in set-version" { +RunTest 'powershell-script fails in set-version' { $testScript = "$testDir/test.ps1" @' param([string] $action, [string] $value) @@ -206,7 +214,7 @@ switch ($action) AssertFailsWith "set-version $currentVersion | output: Failure" { UpdateDependency $testScript } } -RunTest "bash-script fails in set-version" { +RunTest 'bash-script fails in set-version' { $testScript = "$testDir/test.sh" @' #!/usr/bin/env bash @@ -228,4 +236,4 @@ esac '@ | Out-File $testScript AssertFailsWith "set-version $currentVersion | output: Failure" { UpdateDependency $testScript } -} -skipReason ($IsWindows ? "on Windows" : '') +} -skipReason ($IsWindows ? 'on Windows' : '') From 0e8067c21157cbf38618bbf4d3ee2a2c63047e48 Mon Sep 17 00:00:00 2001 From: Ivan Dlugos Date: Fri, 24 Jan 2025 11:22:52 +0100 Subject: [PATCH 8/8] chore: update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f52b18..7104b20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ ### Fixes -- Fix sorting prerelease versions ([#78](https://github.com/getsentry/github-workflows/pull/78)) +- Don't update from a manually-updated prerelease to a latest stable release that is earlier than the prerelease ([#78](https://github.com/getsentry/github-workflows/pull/78)) ## 2.11.0