File tree Expand file tree Collapse file tree 3 files changed +17
-20
lines changed
Expand file tree Collapse file tree 3 files changed +17
-20
lines changed Original file line number Diff line number Diff line change 1+
2+ function GetComparableVersion ([Parameter (Mandatory = $true )][string ] $value )
3+ {
4+ $value = $value -replace ' ^v' , ' '
5+ try {
6+ [System.Management.Automation.SemanticVersion ]::Parse($value )
7+ } catch {
8+ Write-Warning " Failed to parse string '$value ' as semantic version: $_ "
9+ $null
10+ }
11+ }
Original file line number Diff line number Diff line change 33)
44
55Set-StrictMode - Version latest
6-
7- function GetComparableVersion ([Parameter (Mandatory = $true )][string ] $value )
8- {
9- $value = $value -replace ' ^v' , ' '
10- try {
11- [System.Management.Automation.SemanticVersion ]::Parse($value )
12- } catch {
13- Write-Warning " Failed to parse semantic version '$value ': $_ "
14- $null
15- }
16- }
6+ . " $PSScriptRoot /common.ps1"
177
188$List `
199 | Where-Object { $null -ne (GetComparableVersion $_ ) } `
Original file line number Diff line number Diff line change 1414)
1515
1616Set-StrictMode - Version latest
17+ . " $PSScriptRoot /common.ps1"
1718
1819if (-not (Test-Path $Path ))
1920{
@@ -170,15 +171,10 @@ if ("$Tag" -eq "")
170171
171172 # It's possible that the dependency was updated to a pre-release version manually in which case we don't want to
172173 # roll back, even though it's not the latest version matching the configured pattern.
173- try {
174- if ([System.Management.Automation.SemanticVersion ]::Parse(($originalTag -replace ' ^v' , ' ' )) `
175- -ge [System.Management.Automation.SemanticVersion ]::Parse(($latestTag -replace ' ^v' , ' ' )))
176- {
177- Write-Host " SemVer represented by the original tag '$originalTag ' is newer than the latest tag '$latestTag '. Skipping update."
178- return
179- }
180- } catch {
181- Write-Warning " Failed to parse semantic version '$value ': $_ "
174+ if ((GetComparableVersion $originalTag ) -ge (GetComparableVersion $latestTag ))
175+ {
176+ Write-Host " SemVer represented by the original tag '$originalTag ' is newer than the latest tag '$latestTag '. Skipping update."
177+ return
182178 }
183179
184180 # Verify that the latest tag actually points to a different commit. Otherwise, we don't need to update.
You can’t perform that action at this time.
0 commit comments