61
61
container: |
62
62
null
63
63
# Name of the secret that contains the certificate.
64
- certificate-secret: WINDOWS_SIGNING_CERTIFICATE_PFX
64
+ certificate-secret: INSTALLER_CERT_WINDOWS_CER
65
65
# Name of the secret that contains the certificate password.
66
- certificate-password-secret: WINDOWS_SIGNING_CERTIFICATE_PASSWORD
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).
72
74
mergeable-channel-file: 'false'
73
75
artifacts:
74
76
- path: '*Windows_64bit.exe'
75
77
name: Windows_X86-64_interactive_installer
78
+ - path: '*Windows_64bit_signed.exe'
79
+ name: Windows_X86-64_interactive_installer_signed
76
80
- path: '*Windows_64bit.msi'
77
81
name: Windows_X86-64_MSI
78
82
- path: '*Windows_64bit.zip'
@@ -345,14 +349,15 @@ jobs:
345
349
IS_NIGHTLY : ${{ needs.build-type-determination.outputs.is-nightly }}
346
350
IS_RELEASE : ${{ needs.build-type-determination.outputs.is-release }}
347
351
CAN_SIGN : ${{ secrets[matrix.config.certificate-secret] != '' }}
352
+ IS_WINDOWS_CONFIG : ${{ matrix.config.name == 'Windows' }}
348
353
# The CREATE_* environment vars are only used to run tests. These secrets are optional. Dependent tests will
349
354
# be skipped if not available.
350
355
CREATE_USERNAME : ${{ secrets.CREATE_USERNAME }}
351
356
CREATE_PASSWORD : ${{ secrets.CREATE_PASSWORD }}
352
357
CREATE_CLIENT_SECRET : ${{ secrets.CREATE_CLIENT_SECRET }}
353
358
run : |
354
359
# See: https://www.electron.build/code-signing
355
- if [ $CAN_SIGN = false ]; then
360
+ if [ $CAN_SIGN = false ] || [ $IS_WINDOWS_CONFIG = true ] ; then
356
361
echo "Skipping the app signing: certificate not provided."
357
362
else
358
363
export CSC_LINK="${{ runner.temp }}/signing_certificate.${{ matrix.config.certificate-extension }}"
@@ -372,7 +377,7 @@ jobs:
372
377
yarn --cwd electron-app rebuild
373
378
yarn --cwd electron-app build
374
379
yarn --cwd electron-app package
375
-
380
+
376
381
# Both macOS jobs generate a "channel update info file" with same path and name. The second job to complete would
377
382
# overwrite the file generated by the first in the workflow artifact.
378
383
- name : Stage channel file for merge
@@ -406,11 +411,71 @@ jobs:
406
411
name : ${{ env.JOB_TRANSFER_ARTIFACT }}
407
412
path : ${{ env.BUILD_ARTIFACTS_PATH }}
408
413
414
+ sign-windows :
415
+ runs-on : [self-hosted, windows-sign-pc]
416
+ needs : build
417
+
418
+ defaults :
419
+ run :
420
+ shell : bash
421
+
422
+ env :
423
+ BUILD_ARTIFACTS_PATH : electron-app/dist/build-artifacts
424
+ INSTALLER_CERT_WINDOWS_CER : " /tmp/cert.cer"
425
+ # We are hardcoding the path for signtool because is not present on the windows PATH env var by default.
426
+ # Keep in mind that this path could change when upgrading to a new runner version
427
+ SIGNTOOL_PATH : " C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/signtool.exe"
428
+
429
+ steps :
430
+ - name : Download artifact
431
+ uses : actions/download-artifact@v3
432
+ with :
433
+ name : ${{ env.JOB_TRANSFER_ARTIFACT }}
434
+ path : ${{ env.BUILD_ARTIFACTS_PATH }}
435
+
436
+ - name : Save artifact path to variable
437
+ shell : bash
438
+ run : |
439
+ ARTIFACT=$(find "${{ env.BUILD_ARTIFACTS_PATH }}" -name "*Windows_64bit.exe" | head -n 1)
440
+ # Convert to Windows-style path with forward slashes
441
+ FULL_PATH=$(cygpath -w $ARTIFACT | sed 's|\\|/|g')
442
+ echo "ARTIFACT_PATH=$FULL_PATH" >> $GITHUB_ENV
443
+
444
+ - name : Save Win signing certificate to file
445
+ run : echo "${{ secrets.INSTALLER_CERT_WINDOWS_CER }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_CER }}
446
+
447
+ - name : Sign EXE
448
+ env :
449
+ CERT_PASSWORD : ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
450
+ CONTAINER_NAME : ${{ secrets.INSTALLER_CERT_WINDOWS_CONTAINER }}
451
+ # https://stackoverflow.com/questions/17927895/automate-extended-validation-ev-code-signing-with-safenet-etoken
452
+ run : |
453
+ "${{ 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.ARTIFACT_PATH }}
454
+
455
+ - name : Rename signed EXE
456
+ shell : bash
457
+ run : |
458
+ BASE_NAME=$(echo "${{ env.ARTIFACT_PATH }}" | sed 's/.exe$//')
459
+ SIGNED_EXE_PATH="${BASE_NAME}_signed.exe"
460
+ mv "${{ env.ARTIFACT_PATH }}" "$SIGNED_EXE_PATH"
461
+ echo "SIGNED_ARTIFACT_PATH=$SIGNED_EXE_PATH" >> $GITHUB_ENV
462
+
463
+ - name : Upload artifacts with signed EXE
464
+ uses : actions/upload-artifact@v3
465
+ with :
466
+ name : Windows_X86-64_interactive_installer_signed
467
+ path : ${{ env.SIGNED_ARTIFACT_PATH }}
468
+
469
+ # This step is needed because the self hosted runner does not delete files automatically
470
+ - name : Clean up artifacts
471
+ run : rm -rf ${{ env.BUILD_ARTIFACTS_PATH }}
472
+
409
473
merge-channel-files :
410
474
needs :
411
475
- build-type-determination
412
476
- select-targets
413
477
- build
478
+ - sign-windows
414
479
if : needs.select-targets.outputs.merge-channel-files == 'true'
415
480
runs-on : ubuntu-latest
416
481
permissions : {}
@@ -474,6 +539,7 @@ jobs:
474
539
needs :
475
540
- select-targets
476
541
- build
542
+ - sign-windows
477
543
if : always() && needs.build.result != 'skipped'
478
544
runs-on : ubuntu-latest
479
545
@@ -498,6 +564,7 @@ jobs:
498
564
needs :
499
565
- build-type-determination
500
566
- build
567
+ - sign-windows
501
568
runs-on : ubuntu-latest
502
569
outputs :
503
570
BODY : ${{ steps.changelog.outputs.BODY }}
@@ -547,6 +614,7 @@ jobs:
547
614
- build-type-determination
548
615
- merge-channel-files
549
616
- changelog
617
+ - sign-windows
550
618
if : >
551
619
always() &&
552
620
needs.build-type-determination.result == 'success' &&
@@ -580,6 +648,7 @@ jobs:
580
648
- build-type-determination
581
649
- merge-channel-files
582
650
- changelog
651
+ - sign-windows
583
652
if : >
584
653
always() &&
585
654
needs.build-type-determination.result == 'success' &&
@@ -631,6 +700,7 @@ jobs:
631
700
- publish
632
701
- release
633
702
- artifacts
703
+ - sign-windows
634
704
if : always() && needs.build.result != 'skipped'
635
705
runs-on : ubuntu-latest
636
706
0 commit comments