Build Installer Only #1
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: Build Installer Only | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| source_run_id: | |
| description: 'GitHub Actions run ID containing signed artifacts (leave empty for latest)' | |
| required: false | |
| type: string | |
| installer_variant: | |
| description: 'Installer variant to build' | |
| required: true | |
| default: 'mixed' | |
| type: choice | |
| options: | |
| - mixed | |
| - x64-only | |
| - arm64-only | |
| version_override: | |
| description: 'Override version (format: YY.MM.DD)' | |
| required: false | |
| type: string | |
| schedule: | |
| - cron: '0 6 * * 1' # Weekly on Monday morning | |
| env: | |
| BUILD_CONFIGURATION: Release | |
| jobs: | |
| build-installer: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Determine which artifacts to download | |
| - name: Determine Source Run | |
| id: source_run | |
| run: | | |
| $runId = "${{ github.event.inputs.source_run_id }}" | |
| if ([string]::IsNullOrEmpty($runId)) { | |
| Write-Output "No run ID specified, will use latest successful run" | |
| # In a real implementation, you'd query GitHub API for latest successful run | |
| # For now, we'll use a placeholder approach | |
| Write-Output "DOWNLOAD_FROM_LATEST=true" >> $env:GITHUB_ENV | |
| } else { | |
| Write-Output "Using specified run ID: $runId" | |
| Write-Output "SOURCE_RUN_ID=$runId" >> $env:GITHUB_ENV | |
| Write-Output "DOWNLOAD_FROM_LATEST=false" >> $env:GITHUB_ENV | |
| } | |
| $variant = "${{ github.event.inputs.installer_variant }}" | |
| if ([string]::IsNullOrEmpty($variant)) { | |
| $variant = "mixed" | |
| } | |
| Write-Output "INSTALLER_VARIANT=$variant" >> $env:GITHUB_ENV | |
| Write-Output "Building installer variant: $variant" | |
| # Download signed artifacts (this would need GitHub API integration in real implementation) | |
| - name: Download Signed Artifacts | |
| run: | | |
| Write-Output "=== Downloading Signed Artifacts ===" | |
| Write-Output "Variant: $env:INSTALLER_VARIANT" | |
| # Create directory for signed artifacts | |
| New-Item -ItemType Directory -Path "SignedArtifacts" -Force | |
| # In a real implementation, this would download from GitHub API: | |
| # - Signed-Unified-Package-Mixed-Platform-Release | |
| # - Or specific platform artifacts based on variant | |
| Write-Output "⚠️ Note: In production, this step would download from:" | |
| Write-Output " - GitHub Actions API using run ID" | |
| Write-Output " - Or latest successful build artifacts" | |
| Write-Output " - Signed components from SignPath output" | |
| # For demo purposes, show what would be downloaded | |
| Write-Output "Would download artifacts for variant: $env:INSTALLER_VARIANT" | |
| switch ($env:INSTALLER_VARIANT) { | |
| "mixed" { | |
| Write-Output " - ARM64 VDD + Control App" | |
| Write-Output " - x64 VDD + VAD + Control App" | |
| } | |
| "x64-only" { | |
| Write-Output " - x64 VDD + VAD + Control App only" | |
| } | |
| "arm64-only" { | |
| Write-Output " - ARM64 VDD + Control App only" | |
| } | |
| } | |
| # Checkout installer repository | |
| - name: Checkout Virtual Driver Installer Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: 'VirtualDrivers/Virtual-Driver-Installer' | |
| path: 'installer-repo' | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Setup version | |
| - name: Setup Version | |
| run: | | |
| $version = "${{ github.event.inputs.version_override }}" | |
| if ([string]::IsNullOrEmpty($version)) { | |
| $version = (Get-Date).ToString('yy.MM.dd') | |
| } | |
| Write-Output "INSTALLER_VERSION=$version" >> $env:GITHUB_ENV | |
| Write-Output "Using version: $version" | |
| # Build installer | |
| - name: Build Installer | |
| run: | | |
| Write-Output "=== Building Virtual Driver Installer ===" | |
| Write-Output "Variant: $env:INSTALLER_VARIANT" | |
| Write-Output "Version: $env:INSTALLER_VERSION" | |
| Push-Location installer-repo | |
| # Install Inno Setup | |
| Write-Output "Installing Inno Setup..." | |
| choco install innosetup -y | |
| if ($LASTEXITCODE -ne 0) { | |
| Write-Output "Failed to install Inno Setup" | |
| exit 1 | |
| } | |
| # Copy signed artifacts (in production, these would be real files) | |
| if (Test-Path "../SignedArtifacts") { | |
| Write-Output "Copying signed artifacts to installer input..." | |
| Copy-Item "../SignedArtifacts/*" -Destination "SignedArtifacts/" -Recurse -Force -ErrorAction SilentlyContinue | |
| } | |
| # Create mock signed artifacts for demonstration | |
| Write-Output "Creating demonstration artifacts structure..." | |
| New-Item -ItemType Directory -Path "SignedArtifacts/ARM64/VDD" -Force | |
| New-Item -ItemType Directory -Path "SignedArtifacts/ARM64/ControlApp" -Force | |
| New-Item -ItemType Directory -Path "SignedArtifacts/x64/VDD" -Force | |
| New-Item -ItemType Directory -Path "SignedArtifacts/x64/VAD" -Force | |
| New-Item -ItemType Directory -Path "SignedArtifacts/x64/ControlApp" -Force | |
| # Modify installer script based on variant | |
| if (Test-Path "Setup.iss") { | |
| $setupContent = Get-Content "Setup.iss" | |
| # Update version | |
| $setupContent = $setupContent -replace '#define MyAppVersion ".*"', "#define MyAppVersion `"$env:INSTALLER_VERSION`"" | |
| # Modify based on variant | |
| switch ($env:INSTALLER_VARIANT) { | |
| "x64-only" { | |
| $setupContent = $setupContent -replace 'OutputBaseFilename=.*', "OutputBaseFilename=Virtual-Driver-Control-v$env:INSTALLER_VERSION-setup-x64-only" | |
| Write-Output "Configured for x64-only installer" | |
| } | |
| "arm64-only" { | |
| $setupContent = $setupContent -replace 'OutputBaseFilename=.*', "OutputBaseFilename=Virtual-Driver-Control-v$env:INSTALLER_VERSION-setup-arm64-only" | |
| Write-Output "Configured for ARM64-only installer" | |
| } | |
| default { | |
| $setupContent = $setupContent -replace 'OutputBaseFilename=.*', "OutputBaseFilename=Virtual-Driver-Control-v$env:INSTALLER_VERSION-setup-mixed-platform" | |
| Write-Output "Configured for mixed-platform installer" | |
| } | |
| } | |
| $setupContent | Set-Content "Setup.iss" | |
| } | |
| # Run build script if it exists | |
| if (Test-Path "build-installer.ps1") { | |
| Write-Output "Running installer preparation script..." | |
| .\build-installer.ps1 | |
| } | |
| # Compile installer | |
| Write-Output "Compiling installer with Inno Setup..." | |
| if (Test-Path "Setup.iss") { | |
| iscc Setup.iss | |
| if ($LASTEXITCODE -eq 0) { | |
| Write-Output "✅ Installer compilation completed" | |
| # List built installers | |
| if (Test-Path "output/*.exe") { | |
| Write-Output "Built installers:" | |
| Get-ChildItem "output/*.exe" | ForEach-Object { | |
| Write-Output " - $($_.Name) ($(($_.Length / 1MB).ToString('F2')) MB)" | |
| } | |
| # Set output for artifact upload | |
| $installerFiles = Get-ChildItem "output/*.exe" | |
| $installerName = $installerFiles[0].Name | |
| Write-Output "INSTALLER_NAME=$installerName" >> $env:GITHUB_ENV | |
| } else { | |
| Write-Output "❌ No installer files found in output directory" | |
| exit 1 | |
| } | |
| } else { | |
| Write-Output "❌ Installer compilation failed" | |
| exit 1 | |
| } | |
| } else { | |
| Write-Output "❌ Setup.iss not found" | |
| exit 1 | |
| } | |
| Pop-Location | |
| # Upload installer | |
| - name: Upload Installer | |
| if: env.INSTALLER_NAME != '' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: Installer-${{ env.INSTALLER_VARIANT }}-${{ env.INSTALLER_VERSION }} | |
| path: installer-repo/output/${{ env.INSTALLER_NAME }} | |
| retention-days: 30 | |
| # Summary | |
| - name: Build Summary | |
| if: always() | |
| run: | | |
| Write-Output "=== Installer-Only Build Summary ===" | |
| Write-Output "Variant: $env:INSTALLER_VARIANT" | |
| Write-Output "Version: $env:INSTALLER_VERSION" | |
| Write-Output "Trigger: ${{ github.event_name }}" | |
| Write-Output "" | |
| if ($env:INSTALLER_NAME) { | |
| Write-Output "✅ Installer built successfully: $env:INSTALLER_NAME" | |
| } else { | |
| Write-Output "❌ Installer build failed" | |
| } | |
| Write-Output "" | |
| Write-Output "This workflow enables:" | |
| Write-Output "• Building installers without rebuilding drivers" | |
| Write-Output "• Creating multiple installer variants" | |
| Write-Output "• Using previously signed components" | |
| Write-Output "• Scheduled installer updates" | |
| Write-Output "• Manual installer generation with custom versions" |