An open-source cross-platform alternative to AirDrop
ci: improved signing
Tien Do Nam987f096e1910
diff --git a/.github/workflows/build_cli_exe_test.yml b/.github/workflows/build_cli_exe.ymlsimilarity index 100%rename from .github/workflows/build_cli_exe_test.ymlrename to .github/workflows/build_cli_exe.ymldiff --git a/.github/workflows/build_exe_test.yml b/.github/workflows/build_exe.ymlsimilarity index 75%rename from .github/workflows/build_exe_test.ymlrename to .github/workflows/build_exe.ymlindex 8944eed2..cfb86c55 100644--- a/.github/workflows/build_exe_test.yml+++ b/.github/workflows/build_exe.yml@@ -103,24 +103,34 @@ jobs:Copy-Item -Path "support\build\windows\x64\*" -Destination "${{ runner.temp }}\inno" -RecurseNew-Item -ItemType Directory -Force -Path "${{ runner.temp }}\inno-result" | Out-Null- - name: Compile installer (unsigned)- run: iscc /DSkipSignTool "/DPayloadDir=${{ runner.temp }}\inno" "/DResultDir=${{ runner.temp }}\inno-result" support\scripts\compile_windows_exe-inno.iss+ # Inno signs the setup exe AND the embedded uninstaller at compile time via the MySignTool+ # command; signing the finished installer afterwards would leave unins000.exe unsigned.+ - name: Prepare Trusted Signing sign tool for Inno Setup+ run: |+ $dir = "${{ runner.temp }}\trusted-signing"+ New-Item -ItemType Directory -Force -Path $dir | Out-Null+ nuget install Microsoft.Trusted.Signing.Client -x -OutputDirectory $dir+ $dlib = "$dir\Microsoft.Trusted.Signing.Client\bin\x64\Azure.CodeSigning.Dlib.dll"+ if (-not (Test-Path $dlib)) { Write-Error "Azure.CodeSigning.Dlib.dll not found"; exit 1 }+ $signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin\10.*\x64\signtool.exe' | Select-Object -Last 1+ Set-Content "$dir\metadata.json" -Encoding ascii -Value @"+ {+ "Endpoint": "https://neu.codesigning.azure.net/",+ "CodeSigningAccountName": "tienisto",+ "CertificateProfileName": "localsend"+ }+ "@+ Set-Content "$dir\sign.cmd" -Encoding ascii -Value @"+ @echo off+ "$($signtool.FullName)" sign /v /fd SHA256 /tr http://timestamp.acs.microsoft.com /td SHA256 /dlib "$dlib" /dmdf "$dir\metadata.json" %1+ "@++ - name: Compile installer (signed)+ run: iscc "/SMySignTool=${{ runner.temp }}\trusted-signing\sign.cmd `$f" "/DPayloadDir=${{ runner.temp }}\inno" "/DResultDir=${{ runner.temp }}\inno-result" support\scripts\compile_windows_exe-inno.iss- name: Rename installerrun: Rename-Item -Path "${{ runner.temp }}\inno-result\localsend.exe" -NewName "LocalSend-${{ needs.build.outputs.version }}-windows-x86-64.exe"- - name: Sign installer (Azure Trusted Signing)- uses: azure/trusted-signing-action@v0- with:- endpoint: https://neu.codesigning.azure.net/- trusted-signing-account-name: tienisto- certificate-profile-name: localsend- files-folder: ${{ runner.temp }}\inno-result- files-folder-filter: exe- file-digest: SHA256- timestamp-rfc3161: http://timestamp.acs.microsoft.com- timestamp-digest: SHA256-- name: Verify signaturecontinue-on-error: truerun: |diff --git a/.github/workflows/build_zip_arm64_test.yml b/.github/workflows/build_zip_arm64.ymlsimilarity index 100%rename from .github/workflows/build_zip_arm64_test.ymlrename to .github/workflows/build_zip_arm64.ymldiff --git a/.github/workflows/build_zip_test.yml b/.github/workflows/build_zip_x64.ymlsimilarity index 100%rename from .github/workflows/build_zip_test.ymlrename to .github/workflows/build_zip_x64.ymldiff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 657b8cd8..28aa0d19 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -644,24 +644,34 @@ jobs:Copy-Item -Path "support\build\windows\x64\*" -Destination "${{ runner.temp }}\inno" -RecurseNew-Item -ItemType Directory -Force -Path "${{ runner.temp }}\inno-result" | Out-Null- - name: Compile installer (unsigned)- run: iscc /DSkipSignTool "/DPayloadDir=${{ runner.temp }}\inno" "/DResultDir=${{ runner.temp }}\inno-result" support\scripts\compile_windows_exe-inno.iss+ # Inno signs the setup exe AND the embedded uninstaller at compile time via the MySignTool+ # command; signing the finished installer afterwards would leave unins000.exe unsigned.+ - name: Prepare Trusted Signing sign tool for Inno Setup+ run: |+ $dir = "${{ runner.temp }}\trusted-signing"+ New-Item -ItemType Directory -Force -Path $dir | Out-Null+ nuget install Microsoft.Trusted.Signing.Client -x -OutputDirectory $dir+ $dlib = "$dir\Microsoft.Trusted.Signing.Client\bin\x64\Azure.CodeSigning.Dlib.dll"+ if (-not (Test-Path $dlib)) { Write-Error "Azure.CodeSigning.Dlib.dll not found"; exit 1 }+ $signtool = Get-ChildItem 'C:\Program Files (x86)\Windows Kits\10\bin\10.*\x64\signtool.exe' | Select-Object -Last 1+ Set-Content "$dir\metadata.json" -Encoding ascii -Value @"+ {+ "Endpoint": "https://neu.codesigning.azure.net/",+ "CodeSigningAccountName": "tienisto",+ "CertificateProfileName": "localsend"+ }+ "@+ Set-Content "$dir\sign.cmd" -Encoding ascii -Value @"+ @echo off+ "$($signtool.FullName)" sign /v /fd SHA256 /tr http://timestamp.acs.microsoft.com /td SHA256 /dlib "$dlib" /dmdf "$dir\metadata.json" %1+ "@++ - name: Compile installer (signed)+ run: iscc "/SMySignTool=${{ runner.temp }}\trusted-signing\sign.cmd `$f" "/DPayloadDir=${{ runner.temp }}\inno" "/DResultDir=${{ runner.temp }}\inno-result" support\scripts\compile_windows_exe-inno.iss- name: Rename installerrun: Rename-Item -Path "${{ runner.temp }}\inno-result\localsend.exe" -NewName "LocalSend-${{ needs.build.outputs.version }}-windows-x86-64.exe"- - name: Sign installer (Azure Trusted Signing)- uses: azure/trusted-signing-action@v0- with:- endpoint: https://neu.codesigning.azure.net/- trusted-signing-account-name: tienisto- certificate-profile-name: localsend- files-folder: ${{ runner.temp }}\inno-result- files-folder-filter: exe- file-digest: SHA256- timestamp-rfc3161: http://timestamp.acs.microsoft.com- timestamp-digest: SHA256-- name: Verify signaturecontinue-on-error: truerun: |diff --git a/support/scripts/compile_windows_exe-inno.iss b/support/scripts/compile_windows_exe-inno.issindex 0a78c7a3..77a0e282 100644--- a/support/scripts/compile_windows_exe-inno.iss+++ b/support/scripts/compile_windows_exe-inno.iss@@ -41,7 +41,9 @@ UninstallDisplayIcon={app}\{#MyAppExeName}Compression=lzmaSolidCompression=yesWizardStyle=modern-; CI passes /DSkipSignTool and signs the resulting installer afterwards+; Sign at compile time: the uninstaller is embedded during compilation, so signing the finished+; installer afterwards would leave it unsigned. CI defines the command via "iscc /SMySignTool=...";+; deliberately unsigned builds pass /DSkipSignTool.#ifndef SkipSignToolSignTool=MySignTool#endif