From f8f125414e9bf706444ac48106eac12ae1d87d54 Mon Sep 17 00:00:00 2001 From: moughxyz Date: Fri, 11 Oct 2024 14:07:52 -0500 Subject: [PATCH] Test sign job --- .github/workflows/desktop.release.prod.yml | 64 ++++++++++++++++++++-- 1 file changed, 59 insertions(+), 5 deletions(-) diff --git a/.github/workflows/desktop.release.prod.yml b/.github/workflows/desktop.release.prod.yml index b35a23069fa..8ed3f2a1c84 100644 --- a/.github/workflows/desktop.release.prod.yml +++ b/.github/workflows/desktop.release.prod.yml @@ -8,8 +8,62 @@ on: workflow_dispatch: jobs: - Build: - uses: standardnotes/app/.github/workflows/desktop.release.reuse.yml@main - secrets: inherit - with: - channel: prod \ No newline at end of file + TestSignWindows: + runs-on: windows-latest + env: + SM_KEYPAIR_ALIAS: ${{ secrets.SM_KEYPAIR_ALIAS }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + registry-url: 'https://registry.npmjs.org' + node-version-file: '.nvmrc' + + - name: Set up certificate + run: | + echo "${{ secrets.SM_CLIENT_CERT_FILE_B64 }}" | base64 --decode > /d/Certificate_pkcs12.p12 + shell: bash + + - name: Set variables + id: variables + run: | + export DEBUG='electron-builder' + + echo "SM_HOST=${{ secrets.SM_HOST }}" >> "$GITHUB_ENV" + echo "SM_API_KEY=${{ secrets.SM_API_KEY }}" >> "$GITHUB_ENV" + echo "SM_CLIENT_CERT_FILE=D:\\Certificate_pkcs12.p12" >> "$GITHUB_ENV" + echo "SM_CLIENT_CERT_PASSWORD=${{ secrets.SM_CLIENT_CERT_PASSWORD }}" >> "$GITHUB_ENV" + + echo "C:\Program Files (x86)\Windows Kits\10\App Certification Kit" >> $GITHUB_PATH + echo "C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools" >> $GITHUB_PATH + echo "C:\Program Files\DigiCert\DigiCert Keylocker Tools" >> $GITHUB_PATH + shell: bash + + - name: Setup Keylocker KSP on windows + run: | + curl -X GET https://one.digicert.com/signingmanager/api-ui/v1/releases/Keylockertools-windows-x64.msi/download -H "x-api-key:%SM_API_KEY%" -o Keylockertools-windows-x64.msi + msiexec /i Keylockertools-windows-x64.msi /quiet /qn + smksp_registrar.exe list + smctl.exe keypair ls + C:\Windows\System32\certutil.exe -csp "DigiCert Signing Manager KSP" -key -user + shell: cmd + + - name: Certificates Sync + run: | + smctl windows certsync + shell: cmd + + - name: Fake Build for Signing Test + run: | + echo "This is a test build file." > D:\\a\\testfile.exe + shell: cmd + + - name: Test Signing + run: | + signtool.exe sign /sha1 ${{ secrets.SM_CODE_SIGNING_CERT_SHA1_HASH }} /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 "D:\\a\\testfile.exe" + signtool.exe verify /v /pa "D:\\a\\testfile.exe" + shell: cmd \ No newline at end of file