Skip to content

Commit

Permalink
signing
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaslopezj committed Aug 26, 2024
1 parent 4a0713a commit 4c34077
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 81 deletions.
108 changes: 53 additions & 55 deletions .electron-builder.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,59 +2,57 @@
* @type {() => import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configurtagation
*/

module.exports = async () => ({
productName: "Justo Hub",
appId: "com.getjusto.Justo Hub",
// afterSign: './scripts/notarize.js',
directories: {
output: "dist",
buildResources: "build",
},
publish: {
provider: "github",
publishAutoUpdate: true,
},
mac: {
hardenedRuntime: true,
electronLanguages: ["en"],
icon: "build/icon.icns",
entitlements:
"./node_modules/electron-builder-notarize/entitlements.mac.inherit.plist",
publish: ["github"],
target: [
{
target: "dmg",
arch: ["arm64", "x64"],
},
{
target: "zip",
arch: ["arm64", "x64"],
},
],
notarize: {
teamId: process.env.APPLE_TEAM_ID,
},
},
win: {
publish: ["github"],
icon: "build/icon.ico",
signingHashAlgorithms: ["sha256"],
sign: "./scripts/sign.js",
artifactName: `Justo-Hub-Setup-v${process.env.npm_package_version}.exe`,
target: [
{
target: "nsis",
arch: ["x64", "ia32"],
},
],
},
nsis: {
oneClick: true,
perMachine: true,
},
dmg: {
icon: "build/icon.icns",
internetEnabled: true,
},
});
productName: 'JustoHub',
appId: 'com.getjusto.crisp',
afterSign: 'electron-builder-notarize',
directories: {
output: 'dist',
buildResources: 'build',
},
publish: {
provider: 'github',
publishAutoUpdate: true,
},
mac: {
hardenedRuntime: true,
electronLanguages: ['en'],
icon: 'build/icon.icns',
entitlements: './node_modules/electron-builder-notarize/entitlements.mac.inherit.plist',
publish: ['github'],
target: [
{
target: 'dmg',
arch: ['arm64', 'x64'],
},
{
target: 'zip',
arch: ['arm64', 'x64'],
},
],
notarize: {
teamId: '3CZ24HA8DS',
},
},
win: {
publish: ['github'],
icon: 'build/icon.ico',
signingHashAlgorithms: ['sha256'],
sign: './signing/sign.js',
artifactName: `Justo-Hub-Setup-v${process.env.npm_package_version}.exe`,
target: [
{
target: 'nsis',
arch: ['x64', 'ia32'],
},
],
},
nsis: {
oneClick: true,
perMachine: true,
},
dmg: {
icon: 'build/icon.icns',
internetEnabled: true,
},
})
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"start": "yarn build && JUSTO_ENV=local electron ./compiled",
"pack": "yarn build && electron-builder --config .electron-builder.config.js --dir",
"build-win": "rm -rf ./dist && yarn build && electron-builder --config .electron-builder.config.js --win",
"release": "rm -rf ./dist && yarn build && electron-builder --config .electron-builder.config.js --win --mac"
"release": "rm -rf ./dist && yarn build && electron-builder --config .electron-builder.config.js --mac"
},
"dependencies": {
"body-parser": "^1.20.2",
Expand Down
1 change: 0 additions & 1 deletion scripts/.gitignore

This file was deleted.

19 changes: 0 additions & 19 deletions scripts/notarize.js

This file was deleted.

6 changes: 6 additions & 0 deletions signing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
cert.crt
cert.der
cert.p7b
release
justo spa
CodeSignTool-v1.3.0
11 changes: 6 additions & 5 deletions scripts/sign.js → signing/sign.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path')
const fs = require('fs')
const childProcess = require('child_process')
Expand All @@ -24,20 +23,22 @@ function sign(configuration) {
const {base, dir} = path.parse(configuration.path)
const tempFile = path.join(TEMP_DIR, base)

const setDir = `cd ./scripts/CodeSignTool-v1.3.0`
const setDir = `cd ./signing/CodeSignTool-v1.3.0`
const signFile = `sh ./CodeSignTool.sh sign -input_file_path="${configuration.path}" -output_dir_path="${TEMP_DIR}" -credential_id="${CREDENTIAL_ID}" -username="${USER_NAME}" -password="${USER_PASSWORD}" -totp_secret="${USER_TOTP}"`
const moveFile = `mv "${tempFile}" "${dir}"`
childProcess.execSync(`${setDir} && ${signFile} && ${moveFile}`, {
stdio: 'inherit'
stdio: 'inherit',
})
} else {
console.warn(`sign.js - Can't sign file ${configuration.path}, missing value for:
console.warn(`sign.js - Can't sign file ${
configuration.path
}, missing value for:
${USER_NAME ? '' : 'WINDOWS_SIGN_USER_NAME'}
${USER_PASSWORD ? '' : 'WINDOWS_SIGN_USER_PASSWORD'}
${CREDENTIAL_ID ? '' : 'WINDOWS_SIGN_CREDENTIAL_ID'}
${USER_TOTP ? '' : 'WINDOWS_SIGN_USER_TOTP'}
`)
// process.exit(1)
process.exit(1)
}
}

Expand Down

0 comments on commit 4c34077

Please sign in to comment.