From c5e78e390c8a743f0b55ca833185f6d5ec334967 Mon Sep 17 00:00:00 2001 From: Michael Hollister Date: Mon, 18 Nov 2024 12:52:31 -0600 Subject: [PATCH] Added windows signing --- receivers/electron/Dockerfile | 4 +++- receivers/electron/forge.config.js | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/receivers/electron/Dockerfile b/receivers/electron/Dockerfile index c1774be..8036444 100644 --- a/receivers/electron/Dockerfile +++ b/receivers/electron/Dockerfile @@ -1,7 +1,9 @@ FROM node:22.10.0-bookworm RUN dpkg --add-architecture i386 -RUN apt update && apt install -y zip dpkg fakeroot rpm wget p7zip-full unzip rsync +RUN apt update && apt install -y zip dpkg fakeroot rpm wget p7zip-full unzip rsync jq awscli +RUN wget https://github.com/ebourg/jsign/releases/download/6.0/jsign_6.0_all.deb +RUN apt install -y ./jsign_6.0_all.deb RUN mkdir -pm755 /etc/apt/keyrings RUN wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key diff --git a/receivers/electron/forge.config.js b/receivers/electron/forge.config.js index 051f400..14ec6a6 100644 --- a/receivers/electron/forge.config.js +++ b/receivers/electron/forge.config.js @@ -1,7 +1,7 @@ const fs = require('fs'); const yargs = require('yargs/yargs'); const { hideBin } = require('yargs/helpers'); -const { exec } = require('child_process'); +const cp = require('child_process'); const path = require('path'); // const extract = require('extract-zip') @@ -11,6 +11,7 @@ const { FuseV1Options, FuseVersion } = require('@electron/fuses'); const argv = yargs(hideBin(process.argv)).argv; const APPLICATION_NAME = 'fcast-receiver'; const APPLICATION_TITLE = 'FCast Receiver'; +const CI_SIGNING_DIR = '/deploy/signing'; module.exports = { packagerConfig: { @@ -106,6 +107,11 @@ module.exports = { postPackage: async (config, packageResults) => { switch (packageResults.platform) { + case "win32": { + const exePath = `./out/${APPLICATION_NAME}-${packageResults.platform}-${packageResults.arch}/${APPLICATION_NAME}.exe`; + console.log(cp.execSync(path.join(CI_SIGNING_DIR, `sign.sh ${exePath}`))); + break; + } case "darwin": { let artifactName = `${APPLICATION_NAME}.app`; if (fs.existsSync(`./out/${APPLICATION_NAME}-${packageResults.platform}-${packageResults.arch}/${artifactName}`)) { @@ -130,7 +136,9 @@ module.exports = { artifactName = `${APPLICATION_NAME}.msi`; if (fs.existsSync(`./out/make/wix/${e.arch}/${artifactName}`)) { - fs.renameSync(`./out/make/wix/${e.arch}/${artifactName}`, path.join(`./out/make/wix/${e.arch}`, generateArtifactName(e.packageJSON, e.platform, e.arch, 'msi'))); + const artifactPath = path.join(`./out/make/wix/${e.arch}`, generateArtifactName(e.packageJSON, e.platform, e.arch, 'msi')); + fs.renameSync(`./out/make/wix/${e.arch}/${artifactName}`, artifactPath); + console.log(cp.execSync(path.join(CI_SIGNING_DIR, `sign.sh ${artifactPath}`))); } break; @@ -145,9 +153,8 @@ module.exports = { console.log(`Making a zip distributable for ${e.platform}/${e.arch}`); const zipPath = path.resolve(process.cwd(), 'out', 'make', 'zip', e.platform, e.arch, generateArtifactName(e.packageJSON, e.platform, e.arch, 'zip')); - exec(`mkdir -p ${path.dirname(zipPath)}`, execOutput); - exec(`cd out/${APPLICATION_NAME}-${e.platform}-${e.arch}; zip -r -y "${zipPath}" "${APPLICATION_TITLE}.app"`, execOutput); - + console.log(cp.execSync(`mkdir -p ${path.dirname(zipPath)}`)); + console.log(cp.execSync(`cd out/${APPLICATION_NAME}-${e.platform}-${e.arch}; zip -r -y "${zipPath}" "${APPLICATION_TITLE}.app"`)); break; } case "linux": { @@ -208,13 +215,6 @@ module.exports = { ], }; -function execOutput(err, stdout, stderr) { - if (err) { - console.log(stderr); - } - console.log(stdout); -} - function getArtifactOS(platform) { switch (platform) { case 'win32':