Skip to content

Commit 3fe7f7d

Browse files
Add REINSTALL=a parameter to msiexec for Windows PowerShell downgrades
Co-authored-by: MariusStorhaug <[email protected]>
1 parent 00a357a commit 3fe7f7d

File tree

2 files changed

+40
-1
lines changed

2 files changed

+40
-1
lines changed

.github/workflows/Action-Test.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,42 @@ jobs:
6565
if ($installed -ne $requested) {
6666
throw "Failed: expected $requested but got $installed"
6767
}
68+
69+
ActionTestDowngrade:
70+
runs-on: windows-latest
71+
name: 'Windows Downgrade Test - 7.5.0 → 7.4.7'
72+
steps:
73+
- name: Checkout repo
74+
uses: actions/checkout@v4
75+
76+
# First install a higher version (7.5.0)
77+
- name: Install PowerShell 7.5.0
78+
uses: ./
79+
with:
80+
Version: 7.5.0
81+
82+
- name: Verify 7.5.0 is installed
83+
shell: pwsh
84+
run: |
85+
$installed = ($PSVersionTable.PSVersion).ToString()
86+
Write-Host "Installed PowerShell version: $installed"
87+
if ($installed -ne "7.5.0") {
88+
throw "Failed: expected 7.5.0 but got $installed"
89+
}
90+
Write-Host "7.5.0 installation verified"
91+
92+
# Now try to downgrade to a lower version (7.4.7)
93+
- name: Downgrade to PowerShell 7.4.7
94+
uses: ./
95+
with:
96+
Version: 7.4.7
97+
98+
- name: Verify 7.4.7 is installed (downgrade test)
99+
shell: pwsh
100+
run: |
101+
$installed = ($PSVersionTable.PSVersion).ToString()
102+
Write-Host "Installed PowerShell version: $installed"
103+
if ($installed -ne "7.4.7") {
104+
throw "Failed: expected 7.4.7 but got $installed (downgrade failed)"
105+
}
106+
Write-Host "Downgrade test PASSED!"

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ runs:
235235
if ($isDowngrade) {
236236
# For downgrades, use force reinstall to overwrite the existing version
237237
Write-Host "Using force reinstall for downgrade scenario..."
238-
Start-Process msiexec.exe -ArgumentList '/f', $msi, '/quiet', '/norestart' -Wait
238+
Start-Process msiexec.exe -ArgumentList '/f', $msi, '/quiet', '/norestart', 'REINSTALL=a' -Wait
239239
} else {
240240
# For upgrades or fresh installs, use regular install
241241
Start-Process msiexec.exe -ArgumentList '/i', $msi, '/quiet', '/norestart' -Wait

0 commit comments

Comments
 (0)