Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions .github/workflows/full-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1614,12 +1614,17 @@ jobs:
Write-Host "Signing Final Installer"
Write-Host "------------------------------------------------------------"

$installerZip = "installer_to_sign.zip"
$signedInstallerZip = "installer_to_sign.signed.zip"
$installerZip = "installer_to_sign_${{ github.sha }}.zip"
$signedInstallerZip = "installer_to_sign_${{ github.sha }}.signed.zip"

$installers = Get-ChildItem -Filter "OpenStudio-*.exe"
if ($installers.Count -gt 0) {
Write-Host "Found installer(s): $($installers.Name)"

# Calculate hash of original installer before compression
$originalHash = (Get-FileHash -Path $installers[0].FullName -Algorithm SHA256).Hash
Write-Host "Original installer hash (SHA256): $originalHash"

Compress-Archive -Path $installers.FullName -DestinationPath $installerZip -Force

Write-Host "Sending installer for signing..."
Expand All @@ -1630,6 +1635,26 @@ jobs:
if (-not (Test-Path signed)) { New-Item -ItemType Directory -Path signed | Out-Null }
Expand-Archive -Path $signedInstallerZip -DestinationPath signed -Force

# Verify the extracted file exists and matches expected name
$extractedFiles = Get-ChildItem -Path signed -Filter "*.exe"
if ($extractedFiles.Count -eq 0) {
Write-Host "::error::No EXE file found in signed archive!"
exit 1
}

$extractedFile = $extractedFiles[0]
$expectedName = $installers[0].Name
if ($extractedFile.Name -ne $expectedName) {
Write-Host "::warning::Signed file name mismatch!"
Write-Host " Expected: $expectedName"
Write-Host " Got: $($extractedFile.Name)"

# Rename to match the original filename to prevent distributing misnamed file
$newPath = Join-Path -Path signed -ChildPath $expectedName
Rename-Item -Path $extractedFile.FullName -NewName $newPath -Force
Write-Host " Renamed to match original: $expectedName"
}

# Cleanup
Remove-Item $installerZip -Force
Remove-Item $signedInstallerZip -Force
Expand Down