-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.js
67 lines (62 loc) · 1.78 KB
/
build.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/**
* This script is used to build the electron app **with notarization**. It is used for the final build and release process.
*/
require('dotenv').config();
const build = require('electron-builder').build;
const { publishOptions } = require('./electron/constants');
/**
* Get the artifact name for the build based on the environment.
* @returns {string}
*/
function artifactName() {
const env = process.env.NODE_ENV;
const prefix = env === 'production' ? '' : 'dev-';
return prefix + '${productName}-${version}-${platform}-${arch}.${ext}';
}
const main = async () => {
console.log('Building...');
/** @type import {CliOptions} from "electron-builder" */
await build({
publish: 'onTag',
config: {
appId: 'xyz.valory.olas-operate-app',
artifactName: artifactName(),
productName: 'Pearl',
files: ['electron/**/*', 'package.json'],
directories: {
output: 'dist',
},
extraResources: [
{
from: 'electron/bins',
to: 'bins',
filter: ['**/*'],
},
{
from: '.env',
to: '.env'
},
],
cscKeyPassword: process.env.CSC_KEY_PASSWORD,
cscLink: process.env.CSC_LINK,
mac: {
target: [
{
target: 'dmg',
arch: [process.env.ARCH], // ARCH env is set during release CI
},
],
publish: publishOptions,
category: 'public.app-category.utilities',
icon: 'electron/assets/icons/splash-robot-head-dock.png',
hardenedRuntime: true,
gatekeeperAssess: false,
entitlements: 'electron/entitlements.mac.plist',
entitlementsInherit: 'electron/entitlements.mac.plist',
},
},
});
};
main().then(() => {
console.log('Build & Notarize complete');
});