Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(feat) macos code signing, notarization #867

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Github release workflow

on: workflow_dispatch

jobs:
checks:
runs-on: macos-latest
env:
# dont treat warning as error
CI: false

strategy:
matrix:
node-version: [18.18.x]

steps:
- name: Install sha256sum
run: brew install coreutils

- name: Checkout Repository
uses: actions/checkout@v3
with:
persist-credentials: false

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Pull bfx-hf-ui-core
run: npm run fetch-core

- name: Install
run: npm install

- name: Build for linux/mac/windows
env:
CSC_KEY_PASSWORD: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_B64 }}
CSC_LINK: ${{ secrets.BFX_APPLE_BUILD_CERTIFICATE_B64 }}
APPLEID: ${{ secrets.BFX_APPLE_ID_USERNAME }}
APPLEIDPASS: ${{ secrets.BFX_APPLE_ID_HONEY_PASSWORD }}
run: npm run deploy

- name: Results
run: ls -l dist
17 changes: 11 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,21 @@
"directories": {
"buildResources": "public"
},
"afterSign": "scripts/notarize.js",
"mac": {
"type": "development",
"icon": "build/icon.png",
"category": "public.app-category.productivity",
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "build/entitlements.mac.plist",
"entitlementsInherit": "build/entitlements.mac.plist",
"artifactName": "${productName}-${version}-${arch}-${os}.${ext}",
"category": "public.app-category.productivity",
"target": [
"dir",
"zip"
]
"target": {
"target": "default",
"arch": [
"x64"
]
}
},
"win": {
"icon": "build/icon.png",
Expand Down Expand Up @@ -127,6 +131,7 @@
"browserslist": "^4.22.0",
"electron": "^26.2.3",
"electron-builder": "^24.6.4",
"electron-notarize": "^1.2.2",
"electron-packager": "17.1.2",
"eslint": "^8.50.0",
"eslint-config-airbnb-base": "^15.0.0",
Expand Down
19 changes: 3 additions & 16 deletions public/entitlements.mac.plist
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
<?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.app-sandbox</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.files.user-selected.executable</key>
<true/>
<key>com.apple.security.device.audio-video-bridging</key>
<true/>
<key>com.apple.security.personal-information.location</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
Expand Down
30 changes: 1 addition & 29 deletions public/lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@ const windowStateKeeper = require('electron-window-state')
const os = require('os')
const { appendFile, mkdir } = require('fs/promises')
const { existsSync } = require('fs')
const enforceMacOSAppLocation = require('../../scripts/enforce-macos-app-location')
const BfxMacUpdater = require('../../scripts/auto-updater/bfx.mac.updater')
const {
showLoadingWindow,
hideLoadingWindow,
} = require('../../scripts/change-loading-win-visibility-state')
const { createAppMenu } = require('../utils/appMenu')
const { createAppTray } = require('../utils/tray')
const syncReadUserSettings = require('../utils/syncReadUserSettings')
Expand All @@ -29,19 +23,7 @@ const { ELECTRON_CONTEXT_ALLOWED_URLS } = require('../constants')
const LOG_DIR_PATH = `${os.tmpdir()}/bfx-hf-ui-logs`
const APP_LOG_PATH = `${LOG_DIR_PATH}/app.log`

const isElectronDebugMode = process.env.REACT_APP_ELECTRON_DEBUG === 'true'

let autoUpdater = _autoUpdater

if (process.platform === 'darwin') {
autoUpdater = new BfxMacUpdater()
autoUpdater.addInstallingUpdateEventHandler(() => {
return showLoadingWindow({
description: 'Updating...',
isRequiredToCloseAllWins: true,
})
})
}
const autoUpdater = _autoUpdater

autoUpdater.allowPrerelease = false
autoUpdater.logger = logger
Expand Down Expand Up @@ -269,11 +251,6 @@ module.exports = class HFUIApplication {
})

autoUpdater.on('update-downloaded', (info) => {
const { downloadedFile } = { ...info }
if (autoUpdater instanceof BfxMacUpdater) {
autoUpdater.setDownloadedFilePath(downloadedFile)
}

this.mainWindow.webContents.send('update_downloaded', info)
})

Expand All @@ -289,7 +266,6 @@ module.exports = class HFUIApplication {
}

this.mainWindow.webContents.send('update_error')
await hideLoadingWindow({ isRequiredToShowMainWin: false })
} catch (_err) {
logger.error('autoUpdater error: ', _err)
}
Expand Down Expand Up @@ -319,10 +295,6 @@ module.exports = class HFUIApplication {
},
)

if (!isElectronDebugMode) {
await enforceMacOSAppLocation()
}

createAppMenu({
app: this.app,
sendOpenSettingsModalMessage: this.sendOpenSettingsModalMessage,
Expand Down
174 changes: 0 additions & 174 deletions scripts/auto-updater/bfx.mac.updater.js

This file was deleted.

Loading
Loading