Build and sign the portable Virtual Driver Control

This commit is contained in:
Mike Rodriguez committed 2026-12-01 21:09:02 -08:00
1 parent 8e1a66b573
commit d2ad2d565a
1 file changed
+131
+131
View File
@@ -11,6 +11,10 @@ on:
- 'LICENSE*'
workflow_dispatch:
inputs:
control_ref:
description: Virtual Driver Control commit SHA to package instead of the display driver
type: string
default: ''
platform:
description: Driver architecture to build
type: choice
@@ -37,6 +41,7 @@ permissions:
jobs:
build:
if: inputs.control_ref == ''
# The WDK driver build is validated against VS 2022; windows-latest is moving to VS 2026.
runs-on: windows-2022
strategy:
@@ -256,3 +261,129 @@ jobs:
run: |
"[SignPath request for ${{ matrix.platform }}]($env:SIGNING_REQUEST_URL)" |
Out-File -FilePath $env:GITHUB_STEP_SUMMARY -Encoding utf8 -Append
control-panel:
if: github.event_name == 'workflow_dispatch' && inputs.control_ref != ''
runs-on: windows-2022
defaults:
run:
shell: pwsh
steps:
- name: Validate the Control commit
env:
CONTROL_REF: ${{ inputs.control_ref }}
SIGNPATH_API_TOKEN: ${{ secrets.SIGNPATH_API_TOKEN }}
SIGNPATH_ORG_ID: ${{ vars.SIGNPATH_ORG_ID }}
run: |
if ($env:CONTROL_REF -cnotmatch '^[0-9a-f]{40}$') { throw 'Provide the full commit SHA from VirtualDrivers/Virtual-Driver-Control.' }
if ($env:SIGNPATH_RELEASE_RUN -ne 'true') { throw 'Select release signing for the Control package.' }
if (!$env:SIGNPATH_API_TOKEN -or !$env:SIGNPATH_ORG_ID) { throw 'SignPath is not configured.' }
- name: Check out the Control source
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: VirtualDrivers/Virtual-Driver-Control
ref: ${{ inputs.control_ref }}
persist-credentials: false
- uses: actions/setup-node@249970729cb0ef3589644e2896645e5dc5ba9c38 # v6
with:
node-version: 24
cache: npm
cache-dependency-path: VirtualDriverControl/package-lock.json
- name: Build the Windows application
working-directory: VirtualDriverControl
env:
CONTROL_REF: ${{ inputs.control_ref }}
run: |
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
$actualRef = git rev-parse HEAD
if ($actualRef -ne $env:CONTROL_REF) { throw 'The checked-out Control commit does not match the requested SHA.' }
"Control source: https://github.com/VirtualDrivers/Virtual-Driver-Control/commit/$actualRef" >> $env:GITHUB_STEP_SUMMARY
npm ci
npm run typecheck
npm run build
npm exec -- electron-builder --win --x64 --dir --publish never '-c.win.signExecutable=false'
New-Item -ItemType Directory -Path 'sign-application' | Out-Null
Copy-Item 'dist\win-unpacked\Virtual Driver Control.exe' 'sign-application\Virtual Driver Control.exe'
- name: Upload the unpacked application executable
id: control_application
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Control-x64-application-unsigned
path: VirtualDriverControl/sign-application/
if-no-files-found: error
- name: Sign the application executable through SignPath
id: sign_control_application
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: control_panel
github-artifact-id: ${{ steps.control_application.outputs.artifact-id }}
github-token: ${{ github.token }}
wait-for-completion: true
wait-for-completion-timeout-in-seconds: 3600
output-artifact-directory: VirtualDriverControl/signed-application/
- name: Package the signed application as a portable executable
working-directory: VirtualDriverControl
run: |
$ErrorActionPreference = 'Stop'
$PSNativeCommandUseErrorActionPreference = $true
$application = 'signed-application\Virtual Driver Control.exe'
$sig = Get-AuthenticodeSignature -LiteralPath $application
if ($sig.Status -ne 'Valid' -or $sig.SignerCertificate.Subject -notmatch '(^|,\s*)CN=SignPath Foundation(,|$)') {
throw "The unpacked application does not have the expected signature ($($sig.Status))."
}
Copy-Item -LiteralPath $application -Destination 'dist\win-unpacked\Virtual Driver Control.exe' -Force
Get-FileHash -LiteralPath $application | Format-List
npm exec -- electron-builder --win portable --x64 --prepackaged dist/win-unpacked --publish never '-c.win.signExecutable=false' '-c.win.artifactName=Virtual Driver Control.exe'
New-Item -ItemType Directory -Path 'sign-portable' | Out-Null
Move-Item -LiteralPath 'dist\Virtual Driver Control.exe' -Destination 'sign-portable\Virtual Driver Control.exe'
- name: Upload the portable executable
id: control_portable
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Control-x64-portable-unsigned
path: VirtualDriverControl/sign-portable/
if-no-files-found: error
- name: Sign the portable executable through SignPath
id: sign_control_portable
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: control_panel
github-artifact-id: ${{ steps.control_portable.outputs.artifact-id }}
github-token: ${{ github.token }}
wait-for-completion: true
wait-for-completion-timeout-in-seconds: 3600
output-artifact-directory: VirtualDriverControl/signed-portable/
- name: Verify the signed portable executable
run: |
$exe = 'VirtualDriverControl\signed-portable\Virtual Driver Control.exe'
$sig = Get-AuthenticodeSignature -LiteralPath $exe
if ($sig.Status -ne 'Valid' -or $sig.SignerCertificate.Subject -notmatch '(^|,\s*)CN=SignPath Foundation(,|$)') {
throw "The portable executable does not have the expected signature ($($sig.Status))."
}
$hash = (Get-FileHash -LiteralPath $exe).Hash
"Portable executable SHA-256: $hash" >> $env:GITHUB_STEP_SUMMARY
- name: Upload the signed Control package
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: Virtual-Driver-Control-x64-signed
path: VirtualDriverControl/signed-portable/
if-no-files-found: error