55
55
- config:
56
56
# Human identifier for the job.
57
57
name: Windows
58
- runs-on: windows-2019
58
+ runs-on: [self-hosted, windows-sign-pc]
59
59
# The value is a string representing a JSON document.
60
60
# Setting this to null causes the job to run directly in the runner machine instead of in a container.
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'
75
+ # as this runs on a self hosted runner, we need to avoid building with the default working directory path,
76
+ # otherwise paths in the build job will be too long for `light.exe`
77
+ # we use the below as a Symbolic link (just changing the wd will break the checkout action)
78
+ # this is a work around (see: https://github.com/actions/checkout/issues/197).
79
+ working-directory: 'C:\a'
73
80
artifacts:
74
81
- path: '*Windows_64bit.exe'
75
82
name: Windows_X86-64_interactive_installer
@@ -270,6 +277,14 @@ jobs:
270
277
env :
271
278
# Location of artifacts generated by build.
272
279
BUILD_ARTIFACTS_PATH : electron-app/dist/build-artifacts
280
+ # to skip passing signing credentials to electron-builder
281
+ IS_WINDOWS_CONFIG : ${{ matrix.config.name == 'Windows' }}
282
+ INSTALLER_CERT_WINDOWS_CER : " /tmp/cert.cer"
283
+ # We are hardcoding the path for signtool because is not present on the windows PATH env var by default.
284
+ # Keep in mind that this path could change when upgrading to a new runner version
285
+ SIGNTOOL_PATH : " C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/signtool.exe"
286
+ WIN_CERT_PASSWORD : ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
287
+ WIN_CERT_CONTAINER_NAME : ${{ secrets.INSTALLER_CERT_WINDOWS_CONTAINER }}
273
288
strategy :
274
289
matrix :
275
290
config : ${{ fromJson(needs.select-targets.outputs.build-matrix) }}
@@ -283,6 +298,19 @@ jobs:
283
298
timeout-minutes : 90
284
299
285
300
steps :
301
+ - name : Pre Clean Up for self-hosted runner
302
+ if : runner.os == 'Windows' && matrix.config.working-directory
303
+ shell : cmd
304
+ run : |
305
+ if exist "${{ matrix.config.working-directory }}" rmdir /s /q "${{ matrix.config.working-directory }}"
306
+ if exist "C:\actions-runner\_work\arduino-ide\arduino-ide" rmdir /s /q "C:\actions-runner\_work\arduino-ide\arduino-ide"
307
+
308
+ - name : Symlink custom working directory
309
+ shell : cmd
310
+ if : runner.os == 'Windows' && matrix.config.working-directory
311
+ run : |
312
+ mklink /d "${{ matrix.config.working-directory }}" "C:\actions-runner\_work\arduino-ide\arduino-ide"
313
+
286
314
- name : Checkout
287
315
if : fromJSON(matrix.config.container) == null
288
316
uses : actions/checkout@v4
@@ -293,42 +321,42 @@ jobs:
293
321
uses : actions/checkout@v3
294
322
295
323
- name : Install Node.js
296
- if : fromJSON(matrix.config.container) == null
324
+ if : fromJSON(matrix.config.container) == null && runner.os != 'Windows'
297
325
uses : actions/setup-node@v4
298
326
with :
299
327
node-version : ${{ env.NODE_VERSION }}
300
328
registry-url : ' https://registry.npmjs.org'
301
329
cache : ' yarn'
302
330
303
331
- name : Install Python 3.x
304
- if : fromJSON(matrix.config.container) == null
332
+ if : fromJSON(matrix.config.container) == null && runner.os != 'Windows'
305
333
uses : actions/setup-python@v5
306
334
with :
307
335
python-version : ' 3.11.x'
308
336
309
337
- name : Install Go
310
- if : fromJSON(matrix.config.container) == null
338
+ if : fromJSON(matrix.config.container) == null && runner.os != 'Windows'
311
339
uses : actions/setup-go@v5
312
340
with :
313
341
go-version : ${{ env.GO_VERSION }}
314
342
315
343
- name : Install Go
316
344
# actions/setup-go@v5 has dependency on a higher version of glibc than available in the Linux container.
317
- if : fromJSON(matrix.config.container) != null
345
+ if : fromJSON(matrix.config.container) != null && runner.os != 'Windows'
318
346
uses : actions/setup-go@v4
319
347
with :
320
348
go-version : ${{ env.GO_VERSION }}
321
349
322
350
- name : Install Taskfile
323
- if : fromJSON(matrix.config.container) == null
351
+ if : fromJSON(matrix.config.container) == null && runner.os != 'Windows'
324
352
uses : arduino/setup-task@v2
325
353
with :
326
354
repo-token : ${{ secrets.GITHUB_TOKEN }}
327
355
version : 3.x
328
356
329
357
- name : Install Taskfile
330
358
# actions/setup-task@v2 has dependency on a higher version of glibc than available in the Linux container.
331
- if : fromJSON(matrix.config.container) != null
359
+ if : fromJSON(matrix.config.container) != null && runner.os != 'Windows'
332
360
uses : arduino/setup-task@v1
333
361
with :
334
362
repo-token : ${{ secrets.GITHUB_TOKEN }}
@@ -350,9 +378,10 @@ jobs:
350
378
CREATE_USERNAME : ${{ secrets.CREATE_USERNAME }}
351
379
CREATE_PASSWORD : ${{ secrets.CREATE_PASSWORD }}
352
380
CREATE_CLIENT_SECRET : ${{ secrets.CREATE_CLIENT_SECRET }}
381
+ working-directory : ${{ runner.os == 'Windows' && matrix.config.working-directory || './' }}
353
382
run : |
354
383
# See: https://www.electron.build/code-signing
355
- if [ $CAN_SIGN = false ]; then
384
+ if [ $CAN_SIGN = false ] || [ $IS_WINDOWS_CONFIG = true ] ; then
356
385
echo "Skipping the app signing: certificate not provided."
357
386
else
358
387
export CSC_LINK="${{ runner.temp }}/signing_certificate.${{ matrix.config.certificate-extension }}"
@@ -372,13 +401,14 @@ jobs:
372
401
yarn --cwd electron-app rebuild
373
402
yarn --cwd electron-app build
374
403
yarn --cwd electron-app package
375
-
404
+
376
405
# Both macOS jobs generate a "channel update info file" with same path and name. The second job to complete would
377
406
# overwrite the file generated by the first in the workflow artifact.
378
407
- name : Stage channel file for merge
379
408
if : >
380
409
needs.select-targets.outputs.merge-channel-files == 'true' &&
381
410
matrix.config.mergeable-channel-file == 'true'
411
+ working-directory : ${{ runner.os == 'Windows' && matrix.config.working-directory || './' }}
382
412
run : |
383
413
staged_channel_files_path="${{ runner.temp }}/staged-channel-files"
384
414
mkdir "$staged_channel_files_path"
@@ -398,13 +428,21 @@ jobs:
398
428
with :
399
429
if-no-files-found : error
400
430
name : ${{ env.STAGED_CHANNEL_FILES_ARTIFACT }}
401
- path : ${{ env.STAGED_CHANNEL_FILES_PATH }}
431
+ path : ${{ runner.os == 'Windows' && matrix.config.working-directory && format('{0}/{1}', matrix.config.working-directory, env.STAGED_CHANNEL_FILES_PATH) || env.STAGED_CHANNEL_FILES_PATH }}
432
+
402
433
403
434
- name : Upload [GitHub Actions]
404
435
uses : actions/upload-artifact@v3
405
436
with :
406
437
name : ${{ env.JOB_TRANSFER_ARTIFACT }}
407
- path : ${{ env.BUILD_ARTIFACTS_PATH }}
438
+ path : ${{ runner.os == 'Windows' && matrix.config.working-directory && format('{0}/{1}', matrix.config.working-directory, env.BUILD_ARTIFACTS_PATH) || env.BUILD_ARTIFACTS_PATH }}
439
+
440
+ - name : Manual Clean up for self-hosted runners
441
+ if : runner.os == 'Windows' && matrix.config.working-directory
442
+ shell : cmd
443
+ run : |
444
+ rmdir /s /q "${{ matrix.config.working-directory }}"
445
+ rmdir /s /q "C:\actions-runner\_work\arduino-ide\arduino-ide"
408
446
409
447
merge-channel-files :
410
448
needs :
0 commit comments