diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 090a8de..fc6c0b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -108,7 +108,8 @@ jobs: $sdkVersion = Find-UsableSdkVersion $kitRoot } if (-not $sdkVersion) { - winget install --id Microsoft.WindowsWDK.10.0.26100 --exact --silent --accept-package-agreements --accept-source-agreements --disable-interactivity + winget install --id Microsoft.WindowsWDK.10.0.26100 --exact --silent ` + --accept-package-agreements --accept-source-agreements --disable-interactivity $kitRoot = $defaultKitRoot $sdkVersion = Find-UsableSdkVersion $kitRoot } diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2ef0b7..b726923 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,7 +68,8 @@ jobs: $sdkVersion = Find-UsableSdkVersion $kitRoot } if (-not $sdkVersion) { - winget install --id Microsoft.WindowsWDK.10.0.26100 --exact --silent --accept-package-agreements --accept-source-agreements --disable-interactivity + winget install --id Microsoft.WindowsWDK.10.0.26100 --exact --silent ` + --accept-package-agreements --accept-source-agreements --disable-interactivity $kitRoot = $defaultKitRoot $sdkVersion = Find-UsableSdkVersion $kitRoot } @@ -86,7 +87,8 @@ jobs: if ([string]::IsNullOrWhiteSpace($version)) { $version = '${{ github.ref_name }}' } - $semverPattern = '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$' + $semverPattern = '^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)' + + '(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$' if ($version -notmatch $semverPattern) { throw "Release version must be a v-prefixed semantic version tag: $version" } @@ -178,8 +180,11 @@ jobs: run: | $ErrorActionPreference = 'Stop' - $kitsRoot = (Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots' -Name KitsRoot10).KitsRoot10 - $signtool = Get-ChildItem -LiteralPath (Join-Path $kitsRoot 'bin') -Recurse -Filter signtool.exe -File -ErrorAction SilentlyContinue | + $installedRoots = 'HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots' + $kitsRoot = (Get-ItemProperty -Path $installedRoots -Name KitsRoot10).KitsRoot10 + $kitsBin = Join-Path $kitsRoot 'bin' + $signtool = Get-ChildItem -LiteralPath $kitsBin -Recurse -Filter signtool.exe -File ` + -ErrorAction SilentlyContinue | Sort-Object -Property FullName -Descending | Select-Object -First 1 if (-not $signtool) { @@ -189,11 +194,12 @@ jobs: # The catalog is generated under the per-config package directory # (e.g. .../windows_driver/Release/driver-package/), so locate it by # search rather than a fixed path that breaks when the layout changes. - $catalogFile = Get-ChildItem -Path 'build-driver/src/driver/windows_driver' -Recurse -Filter 'sunshinevirtualdisplaydriver.cat' -File | + $driverBuild = 'build-driver/src/driver/windows_driver' + $catalogFile = Get-ChildItem -Path $driverBuild -Recurse -Filter 'sunshinevirtualdisplaydriver.cat' -File | Sort-Object -Property LastWriteTime -Descending | Select-Object -First 1 if (-not $catalogFile) { - throw 'Driver catalog sunshinevirtualdisplaydriver.cat was not found under build-driver/src/driver/windows_driver.' + throw "Driver catalog sunshinevirtualdisplaydriver.cat was not found under $driverBuild." } $catalog = $catalogFile.FullName & $signtool.FullName sign /fd SHA256 /sha1 '${{ steps.signing_cert.outputs.thumbprint }}' $catalog @@ -204,7 +210,8 @@ jobs: $verifyOutput = & $signtool.FullName verify /pa $catalog 2>&1 $verifyExitCode = $LASTEXITCODE $verifyText = ($verifyOutput | ForEach-Object { [string]$_ }) -join "`n" - if ($verifyExitCode -ne 0 -and $verifyText -notmatch 'terminated in a root\s+certificate which is not trusted') { + $untrustedRoot = 'terminated in a root\s+certificate which is not trusted' + if ($verifyExitCode -ne 0 -and $verifyText -notmatch $untrustedRoot) { throw "signtool verify failed with exit code $verifyExitCode`n$verifyText" } $verifyText @@ -235,7 +242,8 @@ jobs: throw 'Release package driver directory was not found.' } - Copy-Item -LiteralPath '${{ steps.signing_cert.outputs.cert_path }}' -Destination (Join-Path $driverDirectory.FullName 'SunshineVirtualDisplayDriver.cer') -Force + $certificate = Join-Path $driverDirectory.FullName 'SunshineVirtualDisplayDriver.cer' + Copy-Item -LiteralPath '${{ steps.signing_cert.outputs.cert_path }}' -Destination $certificate -Force Remove-Item -LiteralPath $package[0].FullName -Force Compress-Archive -Path (Join-Path $extractRoot '*') -DestinationPath $package[0].FullName -Force @@ -262,7 +270,8 @@ jobs: } driver_catalog = 'self-signed' } - $evidencePath = Join-Path 'build-driver' "libvirtualdisplay-${{ steps.version.outputs.package_version }}-evidence.json" + $evidenceFile = "libvirtualdisplay-${{ steps.version.outputs.package_version }}-evidence.json" + $evidencePath = Join-Path 'build-driver' $evidenceFile $evidence | ConvertTo-Json -Depth 5 | Set-Content -LiteralPath $evidencePath -Encoding utf8 $releaseNotesPath = Join-Path 'build-driver' 'release-notes.md'