build-installer #23
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 | |
on: | |
workflow_dispatch: | |
jobs: | |
build-drivers: | |
uses: ./.github/workflows/build-drivers.yml | |
permissions: | |
id-token: write | |
contents: read | |
attestations: write | |
secrets: inherit | |
build-guestagent: | |
uses: ./.github/workflows/build-guestagent.yml | |
permissions: | |
id-token: write | |
contents: read | |
attestations: write | |
secrets: inherit | |
build-installer: | |
needs: | |
- build-drivers | |
- build-guestagent | |
runs-on: windows-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Download drivers | |
uses: actions/download-artifact@v4 | |
with: | |
name: drivers-signed | |
path: installer/output/ | |
- name: Download guest agent | |
uses: actions/download-artifact@v4 | |
with: | |
name: guestagent-signed | |
path: xen-guest-agent/target/release/ | |
- name: Add MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: Configure branding | |
run: Set-Content -Path branding.ps1 -Value $Env:XCPNG_WINPV_BRANDING -Force | |
env: | |
XCPNG_WINPV_BRANDING: ${{vars.XCPNG_WINPV_BRANDING}} | |
- name: Install certificate | |
# since this runs on new powershell, watch the certutil password parameter syntax | |
run: | | |
$pfxBytes = [System.Convert]::FromBase64String($Env:SIGNER_PFX_BASE64) | |
$pfxPath = Join-Path $pwd "Signer.pfx" | |
[IO.File]::WriteAllBytes($pfxPath, $pfxBytes) | |
try { | |
certutil -importpfx -f -user -p "" my $pfxPath nochain | |
if ($LASTEXITCODE -ne 0) { | |
throw "certutil failed with error $LASTEXITCODE" | |
} | |
} finally { | |
Remove-Item -Force $pfxPath | |
} | |
env: | |
SIGNER_PFX_BASE64: ${{secrets.SIGNER_PFX_BASE64}} | |
- name: Build installer | |
run: .\build-installer.ps1 -Configuration Release -Platform x64 -ExportSymbols | |
env: | |
# The username doesn't matter, just insert a random user here | |
NuGetPackageSourceCredentials_xcpng: Username=xcp-ng;Password=${{secrets.GITHUB_TOKEN}} | |
- name: Clean up certificates | |
run: Remove-Item Cert:\CurrentUser\My\* -ErrorAction SilentlyContinue | |
- name: Upload artifact | |
id: upload | |
uses: actions/upload-artifact@v4 | |
with: | |
path: output/ | |
name: installer | |
outputs: | |
subject-name: installer | |
subject-digest: sha256:${{steps.upload.outputs.artifact-digest}} | |
attest-installer: | |
needs: [build-installer] | |
uses: ./.github/workflows/attest.yml | |
permissions: | |
id-token: write | |
contents: read | |
attestations: write | |
with: | |
subject-name: ${{needs.build-installer.outputs.subject-name}} | |
subject-digest: ${{needs.build-installer.outputs.subject-digest}} |