66
66
certificate-password-secret: INSTALLER_CERT_WINDOWS_PASSWORD
67
67
# File extension for the certificate.
68
68
certificate-extension: pfx
69
+ # Container for windows cert signing
70
+ certificate-container: INSTALLER_CERT_WINDOWS_CONTAINER
69
71
# Quoting on the value is required here to allow the same comparison expression syntax to be used for this
70
72
# and the companion needs.select-targets.outputs.merge-channel-files property (output values always have string
71
73
# type).
@@ -270,6 +272,13 @@ jobs:
270
272
env :
271
273
# Location of artifacts generated by build.
272
274
BUILD_ARTIFACTS_PATH : electron-app/dist/build-artifacts
275
+ IS_WINDOWS_CONFIG : ${{ matrix.config.name == 'Windows' }}
276
+ INSTALLER_CERT_WINDOWS_CER : " /tmp/cert.cer"
277
+ # We are hardcoding the path for signtool because is not present on the windows PATH env var by default.
278
+ # Keep in mind that this path could change when upgrading to a new runner version
279
+ SIGNTOOL_PATH : " C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/signtool.exe"
280
+ CERT_PASSWORD : ${{ secrets[matrix.config.certificate-password-secret] }}
281
+ CONTAINER_NAME : ${{ secrets[matrix.config.certificate-container] }}
273
282
strategy :
274
283
matrix :
275
284
config : ${{ fromJson(needs.select-targets.outputs.build-matrix) }}
@@ -352,7 +361,7 @@ jobs:
352
361
CREATE_CLIENT_SECRET : ${{ secrets.CREATE_CLIENT_SECRET }}
353
362
run : |
354
363
# See: https://www.electron.build/code-signing
355
- if [ $CAN_SIGN = false ]; then
364
+ if [ $CAN_SIGN = false ] || [ $IS_WINDOWS_CONFIG = true ] ; then
356
365
echo "Skipping the app signing: certificate not provided."
357
366
else
358
367
export CSC_LINK="${{ runner.temp }}/signing_certificate.${{ matrix.config.certificate-extension }}"
@@ -371,8 +380,19 @@ jobs:
371
380
372
381
yarn --cwd electron-app rebuild
373
382
yarn --cwd electron-app build
374
- yarn --cwd electron-app package
383
+ yarn --cwd electron-app
384
+
385
+ - name : Save Windows signing certificate to file
386
+ if : ${{ matrix.config.name == 'Windows' }}
387
+ run : |
388
+ echo "${{ secrets[matrix.config.certificate-secret] }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_CER }}
375
389
390
+
391
+ - name : Sign Windows EXE
392
+ if : ${{ matrix.config.name == 'Windows' }}
393
+ run : |
394
+ "${{ env.SIGNTOOL_PATH }}" sign -d "Arduino IDE" -f ${{ env.INSTALLER_CERT_WINDOWS_CER }} -csp "eToken Base Cryptographic Provider" -k "[{{${{ env.CERT_PASSWORD }}}}]=${{ env.CONTAINER_NAME }}" -fd sha256 -tr http://timestamp.digicert.com -td SHA256 -v ${{ env.BUILD_ARTIFACTS_PATH }}/*."exe"
395
+
376
396
# Both macOS jobs generate a "channel update info file" with same path and name. The second job to complete would
377
397
# overwrite the file generated by the first in the workflow artifact.
378
398
- name : Stage channel file for merge
0 commit comments