@@ -272,13 +272,6 @@ jobs:
272
272
env :
273
273
# Location of artifacts generated by build.
274
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/x64/signtool.exe"
280
- CERT_PASSWORD : ${{ secrets[matrix.config.certificate-password-secret] }}
281
- CONTAINER_NAME : ${{ secrets[matrix.config.certificate-container] }}
282
275
strategy :
283
276
matrix :
284
277
config : ${{ fromJson(needs.select-targets.outputs.build-matrix) }}
@@ -380,19 +373,8 @@ jobs:
380
373
381
374
yarn --cwd electron-app rebuild
382
375
yarn --cwd electron-app build
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 }}
389
-
376
+ yarn --cwd electron-app
390
377
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
-
396
378
# Both macOS jobs generate a "channel update info file" with same path and name. The second job to complete would
397
379
# overwrite the file generated by the first in the workflow artifact.
398
380
- name : Stage channel file for merge
@@ -425,12 +407,61 @@ jobs:
425
407
with :
426
408
name : ${{ env.JOB_TRANSFER_ARTIFACT }}
427
409
path : ${{ env.BUILD_ARTIFACTS_PATH }}
428
-
410
+
411
+ sign-windows :
412
+ runs-on : [self-hosted, windows-sign-pc]
413
+ needs : build
414
+
415
+ defaults :
416
+ run :
417
+ shell : bash
418
+
419
+ env :
420
+ INSTALLER_CERT_WINDOWS_CER : " /tmp/cert.cer"
421
+ # We are hardcoding the path for signtool because is not present on the windows PATH env var by default.
422
+ # Keep in mind that this path could change when upgrading to a new runner version
423
+ SIGNTOOL_PATH : " C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/signtool.exe"
424
+
425
+ steps :
426
+ - name : Download artifact
427
+ uses : actions/download-artifact@v3
428
+ with :
429
+ name : Windows_X86-64_interactive_installer
430
+
431
+ - name : Save artifact path to variable
432
+ run : |
433
+ # Find the artifact ending with 'Windows_64bit.exe' in the specified download directory
434
+ ARTIFACT_PATH=$(find . -name "*Windows_64bit.exe")
435
+ echo "ARTIFACT_PATH=${ARTIFACT_PATH}" >> $GITHUB_ENV
436
+
437
+ - name : Save Win signing certificate to file
438
+ run : echo "${{ secrets[matrix.config.certificate-secret] }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_CER }}
439
+
440
+ - name : Sign EXE
441
+ env :
442
+ CERT_PASSWORD : ${{ secrets[matrix.config.certificate-password-secret] }}
443
+ CONTAINER_NAME : ${{ secrets[matrix.config.certificate-container] }}
444
+ # https://stackoverflow.com/questions/17927895/automate-extended-validation-ev-code-signing-with-safenet-etoken
445
+ run : |
446
+ "${{ 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 }}"
447
+
448
+ # upload signed exe to artifacts overwriting existing
449
+ - name : Upload signed EXE
450
+ uses : actions/upload-artifact@v3
451
+ with :
452
+ name : Windows_X86-64_interactive_installer
453
+ path : ${{ env.ARTIFACT_PATH }}
454
+
455
+ # This step is needed because the self hosted runner does not delete files automatically
456
+ - name : Clean up EXE
457
+ run : rm ${{ env.ARTIFACT_PATH }}
458
+
429
459
merge-channel-files :
430
460
needs :
431
461
- build-type-determination
432
462
- select-targets
433
463
- build
464
+ - sign-windows
434
465
if : needs.select-targets.outputs.merge-channel-files == 'true'
435
466
runs-on : ubuntu-latest
436
467
permissions : {}
@@ -494,6 +525,7 @@ jobs:
494
525
needs :
495
526
- select-targets
496
527
- build
528
+ - sign-windows
497
529
if : always() && needs.build.result != 'skipped'
498
530
runs-on : ubuntu-latest
499
531
@@ -518,6 +550,7 @@ jobs:
518
550
needs :
519
551
- build-type-determination
520
552
- build
553
+ - sign-windows
521
554
runs-on : ubuntu-latest
522
555
outputs :
523
556
BODY : ${{ steps.changelog.outputs.BODY }}
@@ -567,6 +600,7 @@ jobs:
567
600
- build-type-determination
568
601
- merge-channel-files
569
602
- changelog
603
+ - sign-windows
570
604
if : >
571
605
always() &&
572
606
needs.build-type-determination.result == 'success' &&
@@ -600,6 +634,7 @@ jobs:
600
634
- build-type-determination
601
635
- merge-channel-files
602
636
- changelog
637
+ - sign-windows
603
638
if : >
604
639
always() &&
605
640
needs.build-type-determination.result == 'success' &&
@@ -651,6 +686,7 @@ jobs:
651
686
- publish
652
687
- release
653
688
- artifacts
689
+ - sign-windows
654
690
if : always() && needs.build.result != 'skipped'
655
691
runs-on : ubuntu-latest
656
692
0 commit comments