From 03f5da5086cac1289e3ef159c1de4eb4992c2926 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Tue, 7 Nov 2023 00:48:07 +0900
Subject: [PATCH] Setup build configuration
---
electron-builder.yml | 32 +++++++++++++++++++++++++++++++-
notarize.js | 20 ++++++++++++++++++++
package.json | 1 +
plist/child.plist | 10 ++++++++++
plist/entitlements.mac.plist | 10 ++++++++++
plist/loginhelper.plist | 8 ++++++++
plist/parent.plist | 12 ++++++++++++
yarn.lock | 2 +-
8 files changed, 93 insertions(+), 2 deletions(-)
create mode 100644 notarize.js
create mode 100644 plist/child.plist
create mode 100644 plist/entitlements.mac.plist
create mode 100644 plist/loginhelper.plist
create mode 100644 plist/parent.plist
diff --git a/electron-builder.yml b/electron-builder.yml
index 68ecf68d..6a17a8e8 100644
--- a/electron-builder.yml
+++ b/electron-builder.yml
@@ -1,6 +1,7 @@
appId: social.whalebird.app
productName: Whalebird
copyright: Copyright © 2023 Akira Fukushima
+artifactName: "${productName}-${version}-${os}-${arch}.${ext}"
directories:
output: dist
buildResources: resources
@@ -9,7 +10,36 @@ files:
filter:
- package.json
- app
+mac:
+ icon: resources/icons/icon.icns
+ target:
+ - target: dmg
+ arch:
+ - universal
+ category: "public.app-category.social-networking"
+ entitlements: "plist/entitlements.mac.plist"
+ entitlementsInherit: "plist/entitlements.mac.plist"
+ entitlementsLoginHelper: "plist/loginhelper.plist"
+ hardenedRuntime: true
+ gatekeeperAssess: false
+ darkModeSupport: false
+win:
+ icon: resources/icons/icon.ico
+ target:
+ - nsis
linux:
- target: AppImage
+ icon: resources/icons
+ target:
+ - AppImage
+ - deb
+ - rpm
+ - tar.bz2
+ - snap
category: Network
publish: null
+afterSign: "notarize.js"
+dmg:
+ sign: false
+nsis:
+ oneClick: false
+ allowToChangeInstallationDirectory: true
diff --git a/notarize.js b/notarize.js
new file mode 100644
index 00000000..0a3ca4f1
--- /dev/null
+++ b/notarize.js
@@ -0,0 +1,20 @@
+const { notarize } = require('@electron/notarize')
+
+exports.default = async function notarizing(context) {
+ const { electronPlatformName, appOutDir } = context
+ if (electronPlatformName !== 'darwin') {
+ return
+ }
+
+ const appName = context.packager.appInfo.productFilename
+
+ return await notarize({
+ tool: 'notarytool',
+ appBundleId: 'social.whalebird.app',
+ ascProvider: process.env.ASC_PROVIDER,
+ appPath: `${appOutDir}/${appName}.app`,
+ appleId: process.env.APPLE_ID,
+ appleIdPassword: process.env.APPLE_APP_SPECIFIC_PASSWORD,
+ teamId: process.env.TEAM_ID
+ })
+}
diff --git a/package.json b/package.json
index 1b73c383..15ba5880 100644
--- a/package.json
+++ b/package.json
@@ -24,6 +24,7 @@
},
"devDependencies": {
"@babel/runtime-corejs3": "^7.23.2",
+ "@electron/notarize": "^2.1.0",
"@types/node": "^18.11.18",
"@types/react": "^18.0.26",
"autoprefixer": "^10.4.16",
diff --git a/plist/child.plist b/plist/child.plist
new file mode 100644
index 00000000..d8dc69e8
--- /dev/null
+++ b/plist/child.plist
@@ -0,0 +1,10 @@
+
+
+
+
+ com.apple.security.app-sandbox
+
+ com.apple.security.inherit
+
+
+
diff --git a/plist/entitlements.mac.plist b/plist/entitlements.mac.plist
new file mode 100644
index 00000000..55f37a69
--- /dev/null
+++ b/plist/entitlements.mac.plist
@@ -0,0 +1,10 @@
+
+
+
+
+ com.apple.security.cs.allow-jit
+
+ com.apple.security.cs.allow-unsigned-executable-memory
+
+
+
diff --git a/plist/loginhelper.plist b/plist/loginhelper.plist
new file mode 100644
index 00000000..8e31f755
--- /dev/null
+++ b/plist/loginhelper.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ com.apple.security.app-sandbox
+
+
+
diff --git a/plist/parent.plist b/plist/parent.plist
new file mode 100644
index 00000000..6bc4d0cd
--- /dev/null
+++ b/plist/parent.plist
@@ -0,0 +1,12 @@
+
+
+
+
+ com.apple.security.app-sandbox
+
+ com.apple.security.files.user-selected.read-only
+
+ com.apple.security.network.client
+
+
+
diff --git a/yarn.lock b/yarn.lock
index 2e53fc23..bd632245 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1036,7 +1036,7 @@
optionalDependencies:
global-agent "^3.0.0"
-"@electron/notarize@2.1.0":
+"@electron/notarize@2.1.0", "@electron/notarize@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@electron/notarize/-/notarize-2.1.0.tgz#76aaec10c8687225e8d0a427cc9df67611c46ff3"
integrity sha512-Q02xem1D0sg4v437xHgmBLxI2iz/fc0D4K7fiVWHa/AnW8o7D751xyKNXgziA6HrTOme9ul1JfWN5ark8WH1xA==