Skip to content

Commit

Permalink
digicert signing
Browse files Browse the repository at this point in the history
  • Loading branch information
karolsojko committed Nov 21, 2023
1 parent 6602335 commit cdeafee
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 74 deletions.
44 changes: 41 additions & 3 deletions .github/workflows/desktop.test-windows.sign.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,61 @@ on:
jobs:
Windows:
runs-on: windows-latest
env:
WINDOWS_TOKEN_ALIAS: ${{ secrets.WINDOWS_TOKEN_ALIAS }}
WINDOWS_TOKEN_PASSWORD: ${{ secrets.WINDOWS_TOKEN_PASSWORD }}

defaults:
run:
working-directory: packages/desktop

steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
node-version-file: '.nvmrc'
cache: 'yarn'

- run: yarn install --immutable

- run: yarn build:desktop

- run: yarn run webpack --config desktop.webpack.prod.js

- 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: |
dir
echo "::set-output name=version::${GITHUB_REF#refs/tags/v}"
echo "::set-output name=KEYPAIR_NAME::sn-keypair"
echo "::set-output name=CERTIFICATE_NAME::sn-certificate"
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

- run: yarn run electron-builder --windows --x64 --ia32 --publish=never --c.extraMetadata.version=$(node -p "require('./../web/package.json').version")

- name: Upload
Expand Down
55 changes: 0 additions & 55 deletions .github/workflows/desktop.windows.sign.yml

This file was deleted.

23 changes: 7 additions & 16 deletions packages/desktop/scripts/windowsSign.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
exports.default = async function (configuration) {
require('child_process').execSync(
`java \
-jar jsign/jsign-4.1.jar \
--keystore jsign/eToken.cfg \
--storepass "${process.env.WINDOWS_TOKEN_PASSWORD}" \
--storetype PKCS11 \
--tsaurl http://timestamp.digicert.com \
--alias "${process.env.WINDOWS_TOKEN_ALIAS}" \
"${configuration.path}"
`,
{
stdio: 'inherit',
},
)
}
exports.default = async function(configuration) {
if(configuration.path){
require("child_process").execSync(
`smctl sign --keypair-alias=${sn-keypair} --input "${String(configuration.path)}"`
);
}
};

0 comments on commit cdeafee

Please sign in to comment.