Skip to content

Commit f646cd3

Browse files
Simplify Windows installation to use msiexec /f for all scenarios
Co-authored-by: MariusStorhaug <[email protected]>
1 parent b28e25d commit f646cd3

File tree

1 file changed

+1
-26
lines changed

1 file changed

+1
-26
lines changed

action.yml

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -204,23 +204,6 @@ runs:
204204
exit 0
205205
}
206206
207-
# Check if we need to handle a downgrade scenario
208-
$isDowngrade = $false
209-
if ($detected -and $detected -ne $env:REQUESTED_VERSION) {
210-
try {
211-
$detectedVersion = [version]$detected
212-
$requestedVersion = [version]$env:REQUESTED_VERSION
213-
if ($detectedVersion -gt $requestedVersion) {
214-
Write-Host "Downgrade detected: $detected → $($env:REQUESTED_VERSION)"
215-
$isDowngrade = $true
216-
} else {
217-
Write-Host "Upgrade detected: $detected → $($env:REQUESTED_VERSION)"
218-
}
219-
} catch {
220-
Write-Host "Warning: Could not compare versions, proceeding with installation"
221-
}
222-
}
223-
224207
$msi = "PowerShell-$($env:REQUESTED_VERSION)-win-x64.msi"
225208
$url = "https://github.com/PowerShell/PowerShell/releases/download/v$($env:REQUESTED_VERSION)/$msi"
226209
Write-Host "Downloading from: $url"
@@ -231,14 +214,6 @@ runs:
231214
}
232215
233216
Write-Host "Starting installation of PowerShell [$($env:REQUESTED_VERSION)]..."
234-
235-
if ($isDowngrade) {
236-
# For downgrades, use force reinstall to overwrite the existing version
237-
Write-Host "Using force reinstall for downgrade scenario..."
238-
Start-Process msiexec.exe -ArgumentList '/f', $msi, '/quiet', '/norestart' -Wait
239-
} else {
240-
# For upgrades or fresh installs, use regular install
241-
Start-Process msiexec.exe -ArgumentList '/i', $msi, '/quiet', '/norestart' -Wait
242-
}
217+
Start-Process msiexec.exe -ArgumentList '/f', $msi, '/quiet', '/norestart' -Wait
243218
244219
Write-Host "Installation complete. PowerShell [$($env:REQUESTED_VERSION)] is now available."

0 commit comments

Comments
 (0)