Configure SignPath release signing for VDD builds

This commit is contained in:
Mike Rodriguez committed 2026-12-01 21:09:02 -08:00
1 parent 4c4658e214
commit 8e1a66b573
2 files changed
+132 -18

No files matched your search

+125 -17
View File
@@ -10,16 +10,29 @@ on:
- 'docs/**'
- 'LICENSE*'
workflow_dispatch:
inputs:
platform:
description: Driver architecture to build
type: choice
options: [both, x64, ARM64]
default: both
release_signing:
description: Request SignPath release signing for the selected builds
type: boolean
default: false
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
group: "${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' && inputs.release_signing && 'signing' || 'validation' }}"
cancel-in-progress: ${{ !(github.event_name == 'workflow_dispatch' && inputs.release_signing) }}
env:
BUILD_CONFIGURATION: Release
VDD_SOLUTION: Virtual Display Driver (HDR)/MttVDD.sln
UMDF_VERSION: '2.25'
SIGNPATH_RELEASE_RUN: ${{ github.event_name == 'workflow_dispatch' && inputs.release_signing }}
permissions:
actions: read
contents: read
jobs:
@@ -29,13 +42,14 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [x64, ARM64]
platform: ${{ fromJSON(inputs.platform == 'x64' && '["x64"]' || inputs.platform == 'ARM64' && '["ARM64"]' || '["x64","ARM64"]') }}
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: true
persist-credentials: false
- name: Setup MSBuild
uses: microsoft/setup-msbuild@30375c66a4eea26614e0d39710365f22f8b0af57 # v3.0.0
@@ -47,7 +61,7 @@ jobs:
choco install windowsdriverkit11 -y --no-progress
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Detect Windows SDK (windows.h)
- name: Detect matching Windows SDK and WDK headers
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
@@ -71,12 +85,15 @@ jobs:
$best =
Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue |
Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
Where-Object { Test-Path (Join-Path $_.FullName "um\Windows.h") } |
Sort-Object -Property Name -Descending |
Where-Object {
(Test-Path (Join-Path $_.FullName "um\Windows.h")) -and
(Test-Path (Join-Path $_.FullName "um\iddcx\1.10\IddCx.h"))
} |
Sort-Object { [version]$_.Name } -Descending |
Select-Object -First 1
if (-not $best) {
throw "Could not find an SDK version directory containing um\\Windows.h under: $includeRoot"
throw "Could not find matching Windows SDK and IddCx headers under $includeRoot"
}
$sdkVersion = $best.Name
@@ -93,7 +110,7 @@ jobs:
$sln = "${{ env.VDD_SOLUTION }}"
if (-not (Test-Path $sln)) { throw "VDD solution file not found at: $sln" }
# Pick an available UMDF WDF header version on the runner.
# Use a released UMDF version that the target OS can load.
# Kits can be laid out either versioned:
# Include\<sdk>\wdf\umdf\2.xx
# or unversioned:
@@ -107,17 +124,22 @@ jobs:
throw "UMDF WDF include root not found under $env:WINDOWS_SDK_DIR (tried versioned + unversioned layouts)"
}
$umdfBest =
$umdf =
$umdfRoots |
ForEach-Object { Get-ChildItem -Path $_ -Directory -ErrorAction SilentlyContinue } |
Where-Object { $_.Name -match '^\d+\.\d+$' } |
Sort-Object -Property Name -Descending |
ForEach-Object { Get-ChildItem -Path $_ -Directory -Filter $env:UMDF_VERSION -ErrorAction SilentlyContinue } |
Select-Object -First 1
if (-not $umdfBest) { throw "No UMDF version directories found under: $($umdfRoots -join ', ')" }
if (-not $umdf) { throw "UMDF $env:UMDF_VERSION headers are absent under $($umdfRoots -join ', ')" }
$umdfMinor = ($umdfBest.Name -split '\.')[1]
Write-Output "Using UMDF version: $($umdfBest.Name) (minor=$umdfMinor) from $($umdfBest.FullName)"
$umdfMinor = ($env:UMDF_VERSION -split '\.')[1]
Write-Output "Using UMDF $env:UMDF_VERSION headers from $($umdf.FullName)"
$buildNumber = [int]$env:GITHUB_RUN_NUMBER
if ($buildNumber -gt 65535) { throw "Driver version component exceeds 65535: $buildNumber" }
$now = [DateTime]::UtcNow
$driverVersion = "{0}.{1}.{2}.{3}" -f ($now.Year % 100), $now.Month, $now.Day, $buildNumber
$driverDate = $now.ToString("MM/dd/yyyy", [Globalization.CultureInfo]::InvariantCulture)
"VDD_DRIVER_VER=$driverDate,$driverVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
msbuild $sln `
/m `
@@ -127,9 +149,12 @@ jobs:
/p:WindowsSdkDir="$env:WINDOWS_SDK_DIR" `
/p:WindowsTargetPlatformVersion="$env:WINDOWS_TARGET_PLATFORM_VERSION" `
/p:UMDF_VERSION_MINOR="$umdfMinor" `
/p:VddDriverVersion="$driverVersion" `
/p:VddDriverDate="$driverDate" `
/p:EnableInfVerif=false `
/p:RunApiValidator=false `
/verbosity:minimal
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
- name: Collect outputs
shell: pwsh
@@ -140,11 +165,94 @@ jobs:
$dest = "artifacts\VDD\${{ matrix.platform }}"
New-Item -ItemType Directory -Path $dest -Force | Out-Null
Copy-Item "$outDir\*" -Destination $dest -Recurse -Force
foreach ($file in @("MttVDD.dll", "MttVDD.inf", "MttVDD.cat", "vdd_settings.xml")) {
Copy-Item -LiteralPath (Join-Path $outDir $file) -Destination (Join-Path $dest $file)
}
- name: Upload artifacts
$inf = Join-Path $dest "MttVDD.inf"
if (-not (Select-String -Path $inf -Pattern "^UmdfLibraryVersion\s*=\s*$([regex]::Escape($env:UMDF_VERSION))\.0\s*$" -Quiet)) {
throw "The packaged INF does not use UMDF $env:UMDF_VERSION"
}
if (-not (Select-String -Path $inf -Pattern "^DriverVer\s*=\s*$([regex]::Escape($env:VDD_DRIVER_VER))\s*$" -Quiet)) {
throw "The packaged INF does not have the expected DriverVer $env:VDD_DRIVER_VER"
}
- name: Upload unsigned driver package
id: unsigned_package
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: VDD-${{ matrix.platform }}-${{ env.BUILD_CONFIGURATION }}
path: artifacts/VDD/${{ matrix.platform }}/
if-no-files-found: error
- name: Check SignPath configuration
if: env.SIGNPATH_RELEASE_RUN == 'true'
shell: pwsh
env:
SIGNPATH_API_TOKEN: ${{ secrets.SIGNPATH_API_TOKEN }}
SIGNPATH_ORG_ID: ${{ vars.SIGNPATH_ORG_ID }}
run: |
foreach ($name in @('SIGNPATH_API_TOKEN', 'SIGNPATH_ORG_ID')) {
if ([string]::IsNullOrWhiteSpace([Environment]::GetEnvironmentVariable($name))) {
throw "Missing GitHub repository configuration: $name"
}
}
- name: Request SignPath release signing
id: signpath
if: env.SIGNPATH_RELEASE_RUN == 'true'
uses: signpath/github-action-submit-signing-request@a2c5b60d9c75f073142b653c354b632eedce097b # v3.2
with:
api-token: ${{ secrets.SIGNPATH_API_TOKEN }}
organization-id: ${{ vars.SIGNPATH_ORG_ID }}
project-slug: Virtual-Display-Driver
signing-policy-slug: release-signing
artifact-configuration-slug: vdd_driver_only
github-artifact-id: ${{ steps.unsigned_package.outputs.artifact-id }}
github-token: ${{ github.token }}
wait-for-completion: true
wait-for-completion-timeout-in-seconds: 3600
output-artifact-directory: signed-artifacts/VDD/${{ matrix.platform }}/
- name: Verify release signatures and catalog membership
if: env.SIGNPATH_RELEASE_RUN == 'true'
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$root = "signed-artifacts\VDD\${{ matrix.platform }}"
foreach ($file in @('MttVDD.dll', 'MttVDD.inf', 'MttVDD.cat', 'vdd_settings.xml')) {
if (-not (Test-Path -LiteralPath (Join-Path $root $file) -PathType Leaf)) {
throw "Missing file in the signed driver package: $file"
}
}
$signtool = Join-Path $env:WINDOWS_SDK_DIR "bin\$env:WINDOWS_TARGET_PLATFORM_VERSION\x64\signtool.exe"
if (-not (Test-Path -LiteralPath $signtool -PathType Leaf)) { throw "SignTool not found: $signtool" }
$catalog = Join-Path $root 'MttVDD.cat'
$driver = Join-Path $root 'MttVDD.dll'
$inf = Join-Path $root 'MttVDD.inf'
& $signtool verify /pa /v $catalog $driver
if ($LASTEXITCODE -ne 0) { throw 'Release signature verification failed' }
foreach ($file in @($inf, $driver)) {
& $signtool verify /pa /v /c $catalog $file
if ($LASTEXITCODE -ne 0) { throw "Catalog membership verification failed: $file" }
}
- name: Upload verified release-signed driver package
if: env.SIGNPATH_RELEASE_RUN == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: VDD-${{ matrix.platform }}-${{ env.BUILD_CONFIGURATION }}-signed
path: signed-artifacts/VDD/${{ matrix.platform }}/
if-no-files-found: error
retention-days: 90
- name: Link the signing request
if: ${{ always() && steps.signpath.outputs.signing-request-web-url != '' }}
shell: pwsh
env:
SIGNING_REQUEST_URL: ${{ steps.signpath.outputs.signing-request-web-url }}
run: |
"[SignPath request for ${{ matrix.platform }}]($env:SIGNING_REQUEST_URL)" |
Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append