Skip to content

Commit 049827e

Browse files
committed
ci: Fix packaging.
1 parent e651310 commit 049827e

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,31 @@ jobs:
152152
- name: Rename MSI to versioned filename
153153
shell: pwsh
154154
run: |
155+
$ErrorActionPreference = 'Stop'
156+
155157
$version = "${{ steps.set_version.outputs.version }}"
156158
$outDir = "$env:GITHUB_WORKSPACE\Installer\Builds"
157-
$msi = Get-ChildItem -Path $outDir -Filter *.msi | Select-Object -First 1
158-
if (-not $msi) { throw "MSI not found in $outDir" }
159+
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
160+
161+
# Find the built MSI in the output directory
162+
$msis = Get-ChildItem -Path $outDir -Filter *.msi -File -ErrorAction SilentlyContinue
163+
if (-not $msis -or $msis.Count -eq 0) {
164+
$listing = (Get-ChildItem -Force $outDir | Select-Object Name,Length,LastWriteTime | Format-Table | Out-String)
165+
throw "No MSI found in $outDir. Current contents:`n$listing"
166+
}
167+
if ($msis.Count -gt 1) {
168+
Write-Warning "Multiple MSIs found in $outDir. Using the first one: $($msis[0].Name)"
169+
}
170+
171+
$msi = $msis[0]
159172
$target = Join-Path $outDir "dmdext-v$version-${{ matrix.platform }}.msi"
160-
Remove-Item $target -Force -ErrorAction SilentlyContinue
161-
Rename-Item -Path $msi.FullName -NewName (Split-Path $target -Leaf)
173+
174+
if (Test-Path $target) { Remove-Item $target -Force }
175+
176+
# Use Move-Item with a full destination path (more reliable than Rename-Item + -NewName)
177+
Move-Item -Path $msi.FullName -Destination $target
178+
Write-Host "MSI renamed to: $target"
179+
162180
163181
# Upload the already-zipped bundle WITHOUT re-compressing
164182
- name: Upload ZIP artifact

0 commit comments

Comments
 (0)