Skip to content

Commit c45fc99

Browse files
authored
Check for Chocolatey version using "choco list" instead of OneGet (#6754)
1 parent 723fc3e commit c45fc99

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

scripts/build-chocolatey.ps1

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,13 @@ if ($Env:YARN_VERSION) {
2525
$latest_version = [String](Invoke-WebRequest -Uri https://yarnpkg.com/latest-version -UseBasicParsing)
2626
}
2727

28-
$latest_chocolatey_version = (Find-Package -Name Yarn).Version
29-
30-
if ([Version]$latest_chocolatey_version -ge [Version]$latest_version) {
31-
Write-Output ('Current version ({0}) is the latest' -f $latest_chocolatey_version)
28+
Write-Output "Checking if $latest_version is already on Chocolatey..."
29+
$choco_output = choco list yarn --exact --version $latest_version | Out-String
30+
if ($choco_output -notmatch '0 packages found') {
31+
Write-Output 'Already on Chocolatey. Nothing to do!'
3232
Exit
3333
}
3434

35-
Write-Output ('Latest version is {0}, version on Chocolatey is {1}. Updating...' -f $latest_version, $latest_chocolatey_version)
36-
3735
if (-Not (Test-Path artifacts)) {
3836
mkdir artifacts
3937
}

0 commit comments

Comments
 (0)