-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Windows builds using a new ssl.com code signing certificate (#3050)
- Loading branch information
Showing
10 changed files
with
129 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const pkg = require("../package.json") | ||
const {join} = require("node:path") | ||
|
||
class Artifact { | ||
get name() { | ||
return `${pkg.productName} Setup ${pkg.version}.exe` | ||
} | ||
|
||
get dir() { | ||
return join(__dirname, "../../../dist/apps/zui") | ||
} | ||
|
||
get path() { | ||
return join(this.dir, this.name) | ||
} | ||
} | ||
|
||
module.exports = new Artifact() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
const {execSync} = require("child_process") | ||
const artifact = require("./artifact") | ||
|
||
// Code below for code signing with SSL.com cert in electron-builder via GitHub | ||
// Inspired from this comment: | ||
// https://github.com/electron-userland/electron-builder/issues/6158#issuecomment-1994110062 | ||
|
||
function sign() { | ||
const scriptPath = process.env.CODE_SIGN_SCRIPT_PATH | ||
process.env.INPUT_COMMAND = "sign" | ||
process.env.INPUT_OVERRIDE = "true" | ||
process.env.INPUT_MALWARE_BLOCK = "false" | ||
process.env.INPUT_CLEAN_LOGS = "false" | ||
process.env.INPUT_JVM_MAX_MEMORY = "1024M" | ||
process.env.INPUT_ENVIRONMENT_NAME = "PROD" | ||
|
||
try { | ||
const output = execSync(`node "${scriptPath}"`).toString() | ||
console.log(`Signing Output: ${output}`) | ||
return true | ||
} catch (error) { | ||
console.error(`Signing Error: ${error.message}`) | ||
if (error.stdout) { | ||
console.log(`Signing Stdout: ${error.stdout.toString()}`) | ||
} | ||
if (error.stderr) { | ||
console.error(`Signing Stderr: ${error.stderr.toString()}`) | ||
} | ||
return false | ||
} | ||
} | ||
|
||
function shouldSign(filePath) { | ||
if (filePath !== artifact.path) { | ||
console.log("Signing Skipped: path not in whitelist '", filePath, "'") | ||
return false | ||
} else { | ||
console.log("Signing Started: '" + filePath + "'") | ||
return true | ||
} | ||
} | ||
|
||
exports.default = async function (configuration) { | ||
if (!process.env.CODE_SIGN_SCRIPT_PATH) { | ||
console.log( | ||
"Signing Skipped: no script path provided in CODE_SIGN_SCRIPT_PATH" | ||
) | ||
return true | ||
} | ||
if (shouldSign(configuration.path)) { | ||
return sign() | ||
} else { | ||
return true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const artifact = require('../../apps/zui/scripts/artifact'); | ||
|
||
console.log(artifact.path); |