@@ -504,22 +504,21 @@ jobs:
504504 $releaseVersion = $releaseVersion.Trim()
505505 $stage = Join-Path $env:RUNNER_TEMP "OpenHCS-Windows-Smoke"
506506 $installRoot = Join-Path $env:RUNNER_TEMP "OpenHCS Installed"
507+ $contractPath = Join-Path $env:RUNNER_TEMP "installer_contract.json"
507508 New-Item -ItemType Directory -Path $stage | Out-Null
508- Copy-Item `
509- packaging/installers/windows/Install-OpenHCS.ps1 `
510- -Destination $stage
509+ python scripts/render_installer_contract.py `
510+ --version $releaseVersion `
511+ --output $contractPath
511512 & packaging/installers/windows/Build-InstallerLauncher.ps1 `
512- -OutputDirectory $stage
513+ -OutputDirectory $stage `
514+ -ContractPath $contractPath
513515 if ($LASTEXITCODE -ne 0) {
514516 throw "Windows GUI installer launcher build failed."
515517 }
516- python scripts/render_installer_contract.py `
517- --version $releaseVersion `
518- --output (Join-Path $stage "installer_contract.json")
519518
520- $launcher = Join-Path $stage "Install- OpenHCS.exe"
519+ $launcher = Join-Path $stage "OpenHCS-Windows-Installer .exe"
521520 if (-not (Test-Path -LiteralPath $launcher -PathType Leaf)) {
522- throw "Windows GUI installer launcher was not staged."
521+ throw "Single-file Windows GUI installer was not staged."
523522 }
524523 $subsystem = python -c "import struct,sys; from pathlib import Path; data=Path(sys.argv[1]).read_bytes(); pe=struct.unpack_from('<I',data,0x3c)[0]; assert data[pe:pe+4]==b'PE\0\0'; print(struct.unpack_from('<H',data,pe+24+68)[0])" $launcher
525524 if ($subsystem.Trim() -ne "2") {
@@ -534,19 +533,32 @@ jobs:
534533 $cancellationPath = Join-Path `
535534 ([IO.Path]::GetTempPath()) `
536535 ("openhcs-installer-cancel-{0}.marker" -f [Guid]::NewGuid().ToString("N"))
537- & $powerShellExecutable `
538- -NoProfile -ExecutionPolicy Bypass `
539- -File (Join-Path $stage "Install-OpenHCS.ps1") `
540- -Worker -InstallRoot $installRoot `
541- -CancellationPath $cancellationPath
542- if ($LASTEXITCODE -ne 0) {
543- throw "Windows installer failed with exit code $LASTEXITCODE."
536+ $installerStartInfo = [Diagnostics.ProcessStartInfo]::new()
537+ $installerStartInfo.FileName = $launcher
538+ $installerStartInfo.UseShellExecute = $false
539+ foreach ($argument in @(
540+ "-Worker",
541+ "-InstallRoot", $installRoot,
542+ "-CancellationPath", $cancellationPath
543+ )) {
544+ [void]$installerStartInfo.ArgumentList.Add([string]$argument)
545+ }
546+ $installerProcess = [Diagnostics.Process]::Start($installerStartInfo)
547+ try {
548+ $installerProcess.WaitForExit()
549+ $installerExitCode = $installerProcess.ExitCode
550+ }
551+ finally {
552+ $installerProcess.Dispose()
553+ }
554+ if ($installerExitCode -ne 0) {
555+ throw "Windows installer failed with exit code $installerExitCode."
544556 }
545557
546558 $desktopRoot = [Environment]::GetFolderPath("DesktopDirectory")
547559 $summaryJson = python -m scripts.smoke_installed_desktop `
548560 --platform windows `
549- --contract (Join-Path $stage "installer_contract.json") `
561+ --contract $contractPath `
550562 --install-root $installRoot `
551563 --desktop-root $desktopRoot
552564 if ($LASTEXITCODE -ne 0) {
@@ -630,6 +642,34 @@ jobs:
630642 "$staged_contract" \
631643 "$installer_app"
632644
645+ dmg_source="$RUNNER_TEMP/OpenHCS Installer DMG"
646+ installer_dmg="$RUNNER_TEMP/OpenHCS-macOS-Installer.dmg"
647+ mount_point="$RUNNER_TEMP/OpenHCS Installer Mount"
648+ mkdir -p "$dmg_source" "$mount_point"
649+ ditto "$installer_app" "$dmg_source/OpenHCS Installer.app"
650+ hdiutil create \
651+ -volname "OpenHCS Installer" \
652+ -srcfolder "$dmg_source" \
653+ -format UDZO \
654+ "$installer_dmg"
655+ hdiutil verify "$installer_dmg"
656+ hdiutil attach \
657+ -nobrowse \
658+ -readonly \
659+ -mountpoint "$mount_point" \
660+ "$installer_dmg"
661+ mounted_dmg=true
662+ cleanup_dmg_mount() {
663+ if [[ "$mounted_dmg" == true ]]; then
664+ hdiutil detach "$mount_point" || true
665+ fi
666+ }
667+ trap cleanup_dmg_mount EXIT
668+ test -d "$mount_point/OpenHCS Installer.app"
669+ hdiutil detach "$mount_point"
670+ mounted_dmg=false
671+ trap - EXIT
672+
633673 mkdir -p "$smoke_home"
634674 export HOME="$smoke_home"
635675 export UV_FIND_LINKS="$GITHUB_WORKSPACE/dist"
0 commit comments