From 4068199a03578d15c5e6d08ba44d7eb8470e9b41 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Sat, 10 Dec 2022 14:13:47 -0600 Subject: [PATCH 1/4] Add env variables for signing and notarizing MacOS --- .github/workflows/release.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7385c9f..c092f47 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -31,8 +31,10 @@ jobs: build-macos: runs-on: macos-latest env: - CSC_LINK: ${{ secrets.CSC_LINK }} - CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} + CSC_LINK: ${{ secrets.MACOS_CSC_LINK }} + CSC_KEY_PASSWORD: ${{ secrets.MACOS_CSC_KEY_PASSWORD }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 From 934dd89b21364d42a1c34fb753d467545ad2704f Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Sat, 10 Dec 2022 14:15:58 -0600 Subject: [PATCH 2/4] add script for notarizing macOS --- notarize.js | 41 +++++++++++++++++++++++++++++++++++++++++ package-lock.json | 42 +++++++++++++++++++++++++++++++++++++++++- package.json | 5 ++++- 3 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 notarize.js diff --git a/notarize.js b/notarize.js new file mode 100644 index 0000000..e32bc5e --- /dev/null +++ b/notarize.js @@ -0,0 +1,41 @@ +const notarize = require('@electron/notarize'); +const fs = require('fs') +const path = require('path') + +module.exports = async function (params) { + if (process.platform !== 'darwin') { + console.log('Only need to notarize MacOS, skipping') + return + } + console.log(params) + const appId = 'com.stagehacks.cueview' + + const appPath = path.join( + params.appOutDir, + `${params.packager.appInfo.productFilename}.app` + ) + if (!fs.existsSync(appPath)) { + console.log('App file not found skipping notarization.'); + return; + } + + console.log( + `Notarizing ${appId} found at ${appPath}` + ) + if(process.env.APPLE_ID === undefined || process.env.APPLE_ID_PASSWORD === undefined){ + console.log('Apple ID and Password must be set in order to notarize.') + return; + } + + try { + await notarize.notarize({ + appBundleId: appId, + appPath, + appleId: process.env.APPLE_ID, + appleIdPassword: process.env.APPLE_ID_PASSWORD, + }) + console.log(`Done notarizing ${appId}`) + } catch (error) { + console.error(error) + } +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index bfbdf42..b87744f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "cue-view", - "version": "0.9.6-pre", + "version": "0.9.8-pre", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -37,6 +37,46 @@ "sumchecker": "^3.0.1" } }, + "@electron/notarize": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-1.2.3.tgz", + "integrity": "sha512-9oRzT56rKh5bspk3KpAVF8lPKHYQrBnRwcgiOeR0hdilVEQmszDaAu0IPCPrwwzJN0ugNs0rRboTreHMt/6mBQ==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "fs-extra": "^9.0.1" + }, + "dependencies": { + "fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "requires": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true + } + } + }, "@electron/universal": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.2.1.tgz", diff --git a/package.json b/package.json index 9c44716..0e7fdfd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cue-view", "productName": "Cue View", - "version": "0.9.7-pre", + "version": "0.9.8-pre", "description": "A dashboard for everything in your show", "main": "main.js", "scripts": { @@ -19,6 +19,7 @@ "homepage": "https://github.com/stagehacks/Cue-View", "repository": "https://github.com/stagehacks/Cue-View", "devDependencies": { + "@electron/notarize": "^1.2.3", "electron": "^21.3.0", "electron-builder": "^23.6.0", "eslint": "^8.27.0", @@ -40,9 +41,11 @@ "appId": "com.stagehacks.cueview", "icon": "./src/img/", "artifactName": "${name}.${os}.v${version}.${ext}", + "afterSign": "notarize.js", "mac": { "category": "Utilities", "icon": "./src/img/icon.icns", + "hardenedRuntime": true, "electronLanguages": [ "en" ], From f18539c70347c7230b56d6dfc35c83b94d4b9e8d Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Sat, 10 Dec 2022 14:16:14 -0600 Subject: [PATCH 3/4] remove macOS auto update warning --- main.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/main.js b/main.js index 42819e6..67ad349 100644 --- a/main.js +++ b/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, Menu, ipcMain, nativeTheme, dialog, shell } = require('electron'); +const { app, BrowserWindow, Menu, ipcMain, nativeTheme, dialog } = require('electron'); const { autoUpdater } = require('electron-updater'); const path = require('path'); @@ -257,7 +257,7 @@ autoUpdater.on('update-available', (updateInfo) => { buttons: ['Download', 'Cancel'], title: 'Update Available', message: title, - detail: `Auto updating is not yet automatic on MacOS. Please manually download and install version ${updateInfo.version}.` + detail: msg } }else{ dialogOpts = { @@ -271,14 +271,7 @@ autoUpdater.on('update-available', (updateInfo) => { dialog.showMessageBox(mainWindow,dialogOpts).then((returnValue) => { // download was clicked if (returnValue.response === 0){ - if(!isMac){ - autoUpdater.downloadUpdate(); - }else{ - // TODO: get code signing working - // temp solution to direct user to download - shell.openExternal("https://github.com/stagehacks/Cue-View/releases/") - } - + autoUpdater.downloadUpdate(); } }) }) From 1963e40efb851aea217e4526ba6ff47d4c19fb74 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Sat, 10 Dec 2022 14:19:00 -0600 Subject: [PATCH 4/4] cleanup notarize script --- notarize.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/notarize.js b/notarize.js index e32bc5e..418b34a 100644 --- a/notarize.js +++ b/notarize.js @@ -7,27 +7,26 @@ module.exports = async function (params) { console.log('Only need to notarize MacOS, skipping') return } - console.log(params) + const appId = 'com.stagehacks.cueview' const appPath = path.join( params.appOutDir, `${params.packager.appInfo.productFilename}.app` ) + if (!fs.existsSync(appPath)) { - console.log('App file not found skipping notarization.'); + console.error('App file not found skipping notarization.'); return; } - - console.log( - `Notarizing ${appId} found at ${appPath}` - ) + if(process.env.APPLE_ID === undefined || process.env.APPLE_ID_PASSWORD === undefined){ console.log('Apple ID and Password must be set in order to notarize.') return; } try { + console.log(`Notarizing ${appId} found at ${appPath}`) await notarize.notarize({ appBundleId: appId, appPath, @@ -36,6 +35,7 @@ module.exports = async function (params) { }) console.log(`Done notarizing ${appId}`) } catch (error) { + console.log('There was an error notarizing.') console.error(error) } } \ No newline at end of file