diff --git a/.github/workflows/release-velopack.yml b/.github/workflows/release-velopack.yml index 41fed39..52ba0fe 100644 --- a/.github/workflows/release-velopack.yml +++ b/.github/workflows/release-velopack.yml @@ -336,9 +336,29 @@ jobs: tenant-id: ${{ vars.AZURE_TENANT_ID }} subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }} - # Signs the app's own executables and DLLs (and the CLI) before packing, so the - # binaries inside the installer, the portable zip, and the update packages are - # all signed (K22-REL-05). + # Signs the executables and DLLs under publish that carry no valid signature + # yet (the app's own binaries and unsigned third-party ones), so the binaries + # inside the installer, the portable zip and the update packages are all + # signed (K22-REL-05). Already-signed files (the .NET runtime, Windows App SDK) + # keep their publisher's signature and are not re-signed: a self-contained + # publish holds ~300 of them at ~2 s each, which is how the first real run + # (gclo v1.0.2-beta.2, #26) hit the signing action's 300 s default timeout. + - name: Select the binaries to sign + if: inputs.sign + id: sign-list + shell: pwsh + env: + K22_MAIN_EXE: ${{ inputs.main-exe }} + K22_CLI_PROJECT: ${{ inputs.cli-project }} + run: | + $all = Get-ChildItem publish -Recurse -Include *.exe, *.dll + $unsigned = @($all | Where-Object { (Get-AuthenticodeSignature -LiteralPath $_.FullName).Status -ne 'Valid' }) + $names = $unsigned | ForEach-Object { $_.Name } + if ($names -notcontains $env:K22_MAIN_EXE) { throw "publish/app/$env:K22_MAIN_EXE is missing or already signed by someone else." } + if ($env:K22_CLI_PROJECT -and -not ($unsigned | Where-Object { $_.Extension -eq '.exe' -and $_.FullName -like '*\publish\cli\*' })) { throw 'publish/cli has no unsigned exe to sign.' } + Write-Output "Signing $($unsigned.Count) of $($all.Count) binaries; $($all.Count - $unsigned.Count) already carry a valid signature." + "files<.json, plus a releases..json feed trimmed to this build's # packages (the local feed may also list the downloaded baseline).