OptiKey Pro - Build Unsigned MSI (no signing) #8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: OptiKey Pro - Build Unsigned MSI (no signing) | |
| # Use this workflow to verify the MSI build pipeline without needing SignPath approval. | |
| # Checks that Advanced Installer can build the MSI and produces the expected MSI. | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-unsigned-msi: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # ============================================================ | |
| # BUILD APPLICATION | |
| # ============================================================ | |
| - name: NuGet restore | |
| shell: pwsh | |
| run: nuget restore .\OptiKeyDeployment.sln -NonInteractive | |
| - name: Setup MSBuild | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Build unsigned Pro application | |
| run: msbuild OptiKeyDeployment.sln /m /t:Rebuild /p:Configuration=Release /p:Platform=x64 | |
| - name: Log Pro application binary | |
| shell: pwsh | |
| run: | | |
| $app = "src/JuliusSweetland.OptiKey.Pro/bin/x64/Release/OptikeyPro.exe" | |
| if (Test-Path $app) { | |
| $info = Get-Item $app | |
| $sig = Get-AuthenticodeSignature $app | |
| Write-Host (" [OK] {0,-35} {1,6}KB sig={2}" -f $info.Name, [math]::Round($info.Length/1KB), $sig.Status) | |
| } else { | |
| throw "[MISS] $app not found" | |
| } | |
| # ============================================================ | |
| # BUILD MSI INSTALLER | |
| # ============================================================ | |
| - name: Setup Advanced Installer | |
| uses: caphyon/advinst-github-action@main | |
| with: | |
| advinst-version: '23.5.1' | |
| advinst-license: ${{ secrets.ADVINST_LICENSE_KEY }} | |
| advinst-enable-automation: 'true' | |
| - name: Set Advanced Installer repository path | |
| shell: pwsh | |
| run: | | |
| $repoPath = Join-Path ${{ github.workspace }} "installer" | |
| Write-Host "Setting repository path to: $repoPath" | |
| AdvancedInstaller.com /SetRepositoryPath "$repoPath" | |
| if ($LASTEXITCODE -ne 0) { throw "Failed to set repository path" } | |
| - name: Build Pro MSI installer | |
| shell: pwsh | |
| run: | | |
| Write-Host "Building OptiKeyPro MSI installer..." | |
| AdvancedInstaller.com /build "${{ github.workspace }}\installer\OptiKeyPro.aip" | |
| if ($LASTEXITCODE -ne 0) { throw "Failed to build Pro MSI installer" } | |
| - name: Patch combo box data into MSI | |
| shell: pwsh | |
| run: | | |
| $tool = "${{ github.workspace }}\src\JuliusSweetland.OptiKey.InstallerTranslations\bin\x64\Release\net48\JuliusSweetland.OptiKey.InstallerTranslations.exe" | |
| $msi = "${{ github.workspace }}\installer\SetupFiles\OptiKeyPro.msi" | |
| Write-Host "Patching combo boxes into MSI..." | |
| & $tool --patch-msi $msi | |
| if ($LASTEXITCODE -ne 0) { throw "Failed to patch combo box data into MSI" } | |
| - name: Log MSI output | |
| shell: pwsh | |
| run: | | |
| $setupFiles = "${{ github.workspace }}\installer\SetupFiles" | |
| Write-Host "" | |
| Write-Host "=== Contents of installer\SetupFiles ===" | |
| if (Test-Path $setupFiles) { | |
| Get-ChildItem $setupFiles -Recurse | ForEach-Object { | |
| $sig = Get-AuthenticodeSignature $_.FullName -ErrorAction SilentlyContinue | |
| Write-Host (" {0,-50} {1,7}KB sig={2}" -f $_.Name, [math]::Round($_.Length/1KB), $sig.Status) | |
| } | |
| } else { | |
| Write-Host " [MISS] SetupFiles directory not found" | |
| } | |
| Write-Host "" | |
| $msi = Join-Path $setupFiles "OptiKeyPro.msi" | |
| if (Test-Path $msi) { | |
| $info = Get-Item $msi | |
| Write-Host "[OK] OptiKeyPro.msi found: $([math]::Round($info.Length/1MB, 1))MB" | |
| } else { | |
| Write-Host "::error::OptiKeyPro.msi not found at expected path: $msi" | |
| exit 1 | |
| } | |
| - name: Upload unsigned MSI as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: optikey-pro-msi-unsigned | |
| path: installer/SetupFiles/OptiKeyPro.msi | |
| if-no-files-found: error |