5555 - config:
5656 # Human identifier for the job.
5757 name: Windows
58- runs-on: windows-2019
58+ runs-on: [self-hosted, windows-sign-pc]
5959 # The value is a string representing a JSON document.
6060 # Setting this to null causes the job to run directly in the runner machine instead of in a container.
6161 container: |
6262 null
6363 # Name of the secret that contains the certificate.
64- certificate-secret: WINDOWS_SIGNING_CERTIFICATE_PFX
64+ certificate-secret: INSTALLER_CERT_WINDOWS_CER
6565 # 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
6767 # File extension for the certificate.
6868 certificate-extension: pfx
69+ # Container for windows cert signing
70+ certificate-container: INSTALLER_CERT_WINDOWS_CONTAINER
6971 # Quoting on the value is required here to allow the same comparison expression syntax to be used for this
7072 # and the companion needs.select-targets.outputs.merge-channel-files property (output values always have string
7173 # type).
7274 mergeable-channel-file: 'false'
75+ # as this runs on a self hosted runner, we need to override the default working directory,
76+ # otherwise paths in the build job will be too long for `light.exe`
77+ working-directory: 'C:\a'
78+ relative-working-directory: '../../../../a'
7379 artifacts:
7480 - path: '*Windows_64bit.exe'
7581 name: Windows_X86-64_interactive_installer
@@ -270,6 +276,14 @@ jobs:
270276 env :
271277 # Location of artifacts generated by build.
272278 BUILD_ARTIFACTS_PATH : electron-app/dist/build-artifacts
279+ # to skip passing signing credentials to electron-builder
280+ IS_WINDOWS_CONFIG : ${{ matrix.config.name == 'Windows' }}
281+ INSTALLER_CERT_WINDOWS_CER : " /tmp/cert.cer"
282+ # We are hardcoding the path for signtool because is not present on the windows PATH env var by default.
283+ # Keep in mind that this path could change when upgrading to a new runner version
284+ SIGNTOOL_PATH : " C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/signtool.exe"
285+ WIN_CERT_PASSWORD : ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
286+ WIN_CERT_CONTAINER_NAME : ${{ secrets.INSTALLER_CERT_WINDOWS_CONTAINER }}
273287 strategy :
274288 matrix :
275289 config : ${{ fromJson(needs.select-targets.outputs.build-matrix) }}
@@ -282,53 +296,59 @@ jobs:
282296
283297 timeout-minutes : 90
284298
285- steps :
299+ steps :
300+ - name : Symlink custom working directory
301+ shell : cmd
302+ if : runner.os == 'Windows' && matrix.config.working-directory
303+ run : |
304+ mklink /d "${{ matrix.config.working-directory }}" "C:\actions-runner\_work\arduino-ide\arduino-ide"
305+
286306 - name : Checkout
287307 if : fromJSON(matrix.config.container) == null
288308 uses : actions/checkout@v4
289-
309+
290310 - name : Checkout
291311 # actions/checkout@v4 has dependency on a higher version of glibc than available in the Linux container.
292312 if : fromJSON(matrix.config.container) != null
293313 uses : actions/checkout@v3
294314
295315 - name : Install Node.js
296- if : fromJSON(matrix.config.container) == null
316+ if : fromJSON(matrix.config.container) == null && runner.os != 'Windows'
297317 uses : actions/setup-node@v4
298318 with :
299319 node-version : ${{ env.NODE_VERSION }}
300320 registry-url : ' https://registry.npmjs.org'
301321 cache : ' yarn'
302322
303323 - name : Install Python 3.x
304- if : fromJSON(matrix.config.container) == null
324+ if : fromJSON(matrix.config.container) == null && runner.os != 'Windows'
305325 uses : actions/setup-python@v5
306326 with :
307327 python-version : ' 3.11.x'
308328
309329 - name : Install Go
310- if : fromJSON(matrix.config.container) == null
330+ if : fromJSON(matrix.config.container) == null && runner.os != 'Windows'
311331 uses : actions/setup-go@v5
312332 with :
313333 go-version : ${{ env.GO_VERSION }}
314334
315335 - name : Install Go
316336 # 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
337+ if : fromJSON(matrix.config.container) != null && runner.os != 'Windows'
318338 uses : actions/setup-go@v4
319339 with :
320340 go-version : ${{ env.GO_VERSION }}
321341
322342 - name : Install Taskfile
323- if : fromJSON(matrix.config.container) == null
343+ if : fromJSON(matrix.config.container) == null && runner.os != 'Windows'
324344 uses : arduino/setup-task@v2
325345 with :
326346 repo-token : ${{ secrets.GITHUB_TOKEN }}
327347 version : 3.x
328348
329349 - name : Install Taskfile
330350 # 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
351+ if : fromJSON(matrix.config.container) != null && runner.os != 'Windows'
332352 uses : arduino/setup-task@v1
333353 with :
334354 repo-token : ${{ secrets.GITHUB_TOKEN }}
@@ -350,9 +370,10 @@ jobs:
350370 CREATE_USERNAME : ${{ secrets.CREATE_USERNAME }}
351371 CREATE_PASSWORD : ${{ secrets.CREATE_PASSWORD }}
352372 CREATE_CLIENT_SECRET : ${{ secrets.CREATE_CLIENT_SECRET }}
373+ working-directory : ${{ runner.os == 'Windows' && matrix.config.working-directory || './' }}
353374 run : |
354375 # See: https://www.electron.build/code-signing
355- if [ $CAN_SIGN = false ]; then
376+ if [ $CAN_SIGN = false ] || [ $IS_WINDOWS_CONFIG = true ] ; then
356377 echo "Skipping the app signing: certificate not provided."
357378 else
358379 export CSC_LINK="${{ runner.temp }}/signing_certificate.${{ matrix.config.certificate-extension }}"
@@ -372,13 +393,14 @@ jobs:
372393 yarn --cwd electron-app rebuild
373394 yarn --cwd electron-app build
374395 yarn --cwd electron-app package
375-
396+
376397 # Both macOS jobs generate a "channel update info file" with same path and name. The second job to complete would
377398 # overwrite the file generated by the first in the workflow artifact.
378399 - name : Stage channel file for merge
379400 if : >
380401 needs.select-targets.outputs.merge-channel-files == 'true' &&
381402 matrix.config.mergeable-channel-file == 'true'
403+ working-directory : ${{ runner.os == 'Windows' && matrix.config.working-directory || './' }}
382404 run : |
383405 staged_channel_files_path="${{ runner.temp }}/staged-channel-files"
384406 mkdir "$staged_channel_files_path"
@@ -398,13 +420,21 @@ jobs:
398420 with :
399421 if-no-files-found : error
400422 name : ${{ env.STAGED_CHANNEL_FILES_ARTIFACT }}
401- path : ${{ env.STAGED_CHANNEL_FILES_PATH }}
423+ 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 }}
424+
402425
403426 - name : Upload [GitHub Actions]
404427 uses : actions/upload-artifact@v3
405428 with :
406429 name : ${{ env.JOB_TRANSFER_ARTIFACT }}
407- path : ${{ env.BUILD_ARTIFACTS_PATH }}
430+ path : ${{ runner.os == 'Windows' && matrix.config.working-directory && format('{0}/{1}', matrix.config.working-directory, env.BUILD_ARTIFACTS_PATH) || env.BUILD_ARTIFACTS_PATH }}
431+
432+ - name : Manual Clean up for self-hosted runners
433+ if : runner.os == 'Windows' && matrix.config.working-directory
434+ shell : cmd
435+ run : |
436+ rmdir /s /q "${{ matrix.config.working-directory }}"
437+ rmdir /s /q "C:\actions-runner\_work\arduino-ide\arduino-ide"
408438
409439 merge-channel-files :
410440 needs :
0 commit comments