-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updating electron-* versions, adding code for Mac code-signing/notari…
…zation, adding linux installer builds in docker
- Loading branch information
1 parent
fb1b690
commit c39c8ef
Showing
8 changed files
with
156 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
node_modules | ||
dist/ | ||
yarn.lock | ||
package-lock.json | ||
/.idea | ||
*.iml | ||
docker.env |
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,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.cs.debugger</key> | ||
<true/> | ||
<key>com.apple.security.cs.allow-jit</key> | ||
<true/> | ||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key> | ||
<true/> | ||
<key>com.apple.security.cs.allow-dyld-environment-variables</key> | ||
<true/> | ||
<key>com.apple.security.cs.disable-library-validation</key> | ||
<true/> | ||
</dict> | ||
</plist> |
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,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
SCRIPT_DIR=$(dirname "$0") | ||
export WORKSPACE=$(cd "${SCRIPT_DIR}/.."; pwd) | ||
if [ -z "${GH_TOKEN}" ]; then | ||
echo "GH_TOKEN environment variable must be set prior to running this script">&2 | ||
exit 1 | ||
fi | ||
|
||
EXAMPLE_ENV_FILE="${WORKSPACE}/docker.env" | ||
echo "EXAMPLE_USER=$(id -un)" > "${EXAMPLE_ENV_FILE}" | ||
# shellcheck disable=SC2129 | ||
echo "EXAMPLE_UID=$(id -u)" >> "${EXAMPLE_ENV_FILE}" | ||
echo "EXAMPLE_GROUP=$(id -gn)" >> "${EXAMPLE_ENV_FILE}" | ||
echo "EXAMPLE_GID=$(id -g)" >> "${EXAMPLE_ENV_FILE}" | ||
echo "GH_TOKEN=${GH_TOKEN}" >> "${EXAMPLE_ENV_FILE}" | ||
|
||
if [ -n "${HTTPS_PROXY}" ]; then | ||
echo "HTTPS_PROXY=${HTTPS_PROXY}" >> "${EXAMPLE_ENV_FILE}" | ||
fi | ||
|
||
docker run --rm -v "${WORKSPACE}:/project" --env-file "${EXAMPLE_ENV_FILE}" electronuserland/builder /project/build/linuxInstallersInDocker.sh |
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,37 @@ | ||
#!/usr/bin/env /bin/bash | ||
if [ -z "${EXAMPLE_USER}" ] || [ -z "${EXAMPLE_UID}" ]; then | ||
echo "EXAMPLE_USER and EXAMPLE_UID environment variables must be set" 1>&2 | ||
exit 1 | ||
fi | ||
if [ -z "${EXAMPLE_GROUP}" ] || [ -z "${EXAMPLE_GID}" ]; then | ||
echo "EXAMPLE_GROUP and EXAMPLE_GID environment variables must be set" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
groupadd --gid "${EXAMPLE_GID}" "${EXAMPLE_GROUP}" | ||
useradd --gid "${EXAMPLE_GID}" --uid "${EXAMPLE_UID}" --shell /bin/bash --no-create-home "${EXAMPLE_USER}" | ||
|
||
# Electron Builder seems to rely on the user's home directory being present... | ||
mkdir -p "/home/${EXAMPLE_USER}" | ||
chmod 777 "/home/${EXAMPLE_USER}" | ||
|
||
# Electron Builder tries to create /scratch when it needs to build a binary (rather than using prebuilt binaries) | ||
# so create it prior to running it with the necessary permissions. | ||
mkdir -p "/scratch" | ||
chmod 777 "/scratch" | ||
|
||
# | ||
# Build the installers | ||
# | ||
cd /project || exit | ||
NPM_COMMAND="npm run publish" | ||
if [ "${HTTPS_PROXY}" != "" ]; then | ||
NPM_COMMAND="HTTPS_PROXY=${HTTPS_PROXY} $NPM_COMMAND" | ||
fi | ||
|
||
su "${EXAMPLE_USER}" --command "${NPM_COMMAND}" | ||
|
||
NPM_EXIT_CODE=$? | ||
if [ ${NPM_EXIT_CODE} -ne 0 ]; then | ||
exit ${NPM_EXIT_CODE} | ||
fi |
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,19 @@ | ||
const { notarize } = require('electron-notarize'); | ||
const path = require('path'); | ||
|
||
exports.default = async function notarizing(context) { | ||
const { electronPlatformName, appOutDir } = context; | ||
if (electronPlatformName !== 'darwin') { | ||
return; | ||
} | ||
|
||
const appName = context.packager.appInfo.productFilename; | ||
const appPath = path.normalize(path.join(process.cwd(), 'dist', 'mac', `${appName}.app`)); | ||
console.log('calling notarize with appPath = %s', appPath); | ||
return await notarize({ | ||
appBundleId: 'com.github.iffy.electronupdaterexample', | ||
appPath: appPath, | ||
appleId: process.env.APPLEID, | ||
appleIdPassword: process.env.APPLEIDPASS, | ||
}); | ||
}; |
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 |
---|---|---|
@@ -1,28 +1,52 @@ | ||
{ | ||
"name": "electron-updater-example", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"main": "main.js", | ||
"description": "electron-updater example project", | ||
"author": "Matt Haggard", | ||
"scripts": { | ||
"publish": "build -p always" | ||
"publish": "electron-builder -p always", | ||
"publish-linux-docker": "./build/linuxInstallers.sh" | ||
}, | ||
"devDependencies": { | ||
"electron": "^3.0.2", | ||
"electron-builder": "^20.28.4" | ||
"electron": "^14.0.1", | ||
"electron-builder": "^22.11.7" | ||
}, | ||
"dependencies": { | ||
"electron-log": "^1.3.0", | ||
"electron-updater": "^4.0.6" | ||
"electron-log": "^4.4.1", | ||
"electron-updater": "^4.3.9" | ||
}, | ||
"build": { | ||
"appId": "com.github.iffy.electronupdaterexample", | ||
"productName": "Electron Updater Example", | ||
"afterSign": "./build.notarize.js", | ||
"directories": { | ||
"output": "dist" | ||
}, | ||
"files": [ | ||
"!.DS_Store" | ||
], | ||
"mac": { | ||
"category": "your.app.category.type", | ||
"target": [ | ||
"zip", | ||
"dmg" | ||
] | ||
"target": "default", | ||
"type": "distribution", | ||
"hardenedRuntime": true, | ||
"gatekeeperAsses": false, | ||
"entitlements": "./build/entitlements.mac.plist" | ||
}, | ||
"dmg": { | ||
"sign": false | ||
}, | ||
"win": { | ||
"target": "nsis" | ||
}, | ||
"nsis": { | ||
"oneClick": false, | ||
"allowToChangeInstallationDirectory": true | ||
}, | ||
"linux": { | ||
"category": "your.app.category.type", | ||
"target": "AppImage" | ||
} | ||
} | ||
} |