Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ituob/itu-ob-editor
Browse files Browse the repository at this point in the history
# Conflicts:
#	package.json
  • Loading branch information
strogonoff committed Dec 6, 2019
2 parents 89159b7 + a44fe99 commit 50f8d4e
Show file tree
Hide file tree
Showing 7 changed files with 361 additions and 9 deletions.
48 changes: 46 additions & 2 deletions .github/workflows/build-electron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,41 @@ on:
push:
branches:
- master
pull_request:

jobs:
build_for_mac:
runs-on: macOS-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@master
with:
node-version: 11
- name: Install dependencies
run: yarn install
- name: Compile
run: yarn compile
- name: Build
env:
AID: ${{ secrets.AID }}
AIP: ${{ secrets.AIP }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
run: yarn dist
- uses: actions/upload-artifact@master
with:
name: dist-mac
path: dist
- name: release
if: github.ref == 'refs/heads/master'
env:
AID: ${{ secrets.AID }}
AIP: ${{ secrets.AIP }}
CSC_LINK: ${{ secrets.CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }}
GH_TOKEN: ${{ secrets.GH_ITUOB_CI_TOKEN }}
run: yarn release

build_for_windows:
runs-on: windows-2016
steps:
Expand All @@ -26,8 +59,19 @@ jobs:
- name: Compile
run: yarn compile
- name: Build
run: yarn dist:win
env:
CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
run: yarn dist
- uses: actions/upload-artifact@master
with:
name: dist
name: dist-windows
path: dist
- name: release
if: github.ref == 'refs/heads/master'
env:
CSC_LINK: ${{ secrets.WIN_CSC_LINK }}
CSC_KEY_PASSWORD: ${{ secrets.WIN_CSC_KEY_PASSWORD }}
GH_TOKEN: ${{ secrets.GH_ITUOB_CI_TOKEN }}
run: yarn release

3 changes: 3 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"esversion": 6
}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11.14.0
12 changes: 12 additions & 0 deletions assets/mac/entitlements.mac.inherit.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?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.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/>
</dict>
</plist>
70 changes: 68 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
{
"name": "itu-ob-editor",
"version": "0.1.1",
"description": "ITU OB data editor",
"repository": "[email protected]:ituob/itu-ob-editor.git",
"bugs": "https://github.com/ituob/itu-ob-editor/issues",
"author": "Ribose Inc. <[email protected]>",
"license": "MIT",
"scripts": {
"dev": "electron-webpack dev",
"compile": "electron-webpack",
"dist": "cross-env DEBUG=electron-builder electron-builder",
"dist:win": "electron-builder -w",
"dist:mac": "electron-builder -m",
"pack": "electron-builder --dir",
"release": "electron-builder --publish always",
"cdist": "yarn compile && electron-builder -mlw",
"cdist:dir": "yarn dist --dir -c.compression=store -c.mac.identity=null"
},
Expand All @@ -21,9 +28,65 @@
},
"build": {
"productName": "ITU OB Editor",
"appId": "org.ituob.editor",
"afterSign": "./scripts/hooks/after-sign.js",
"mac": {
"target": "dmg"
}
"category": "public.app-category.productivity",
"icon": "build/icon.icns",
"target": "dmg",
"gatekeeperAssess": false,
"hardenedRuntime": true,
"entitlements": "assets/mac/entitlements.mac.inherit.plist",
"entitlementsInherit": "assets/mac/entitlements.mac.inherit.plist"
},
"dmg": {
"contents": [
{
"x": 110,
"y": 150
},
{
"x": 440,
"y": 150,
"type": "link",
"path": "/Applications"
}
],
"artifactName": "itu-ob-editor-${version}.${ext}"
},
"win": {
"target": [
{
"target": "nsis",
"arch": [
"x64"
]
},
{
"target": "portable"
}
],
"icon": "build/icon.ico"
},
"nsis": {
"runAfterFinish": true,
"installerIcon": "build/icon.ico",
"artifactName": "electron-gha-${version}.${ext}"
},
"portable": {
"artifactName": "itu-ob-editor.exe"
},
"appx": {
"backgroundColor": "#464646",
"publisherDisplayName": "ituob",
"artifactName": "itu-ob-editor-${version}.${ext}"
},
"publish": [
{
"provider": "github",
"releaseType": "release"
}
]
},
"dependencies": {
"@aeaton/react-prosemirror": "https://github.com/riboseinc/react-prosemirror#aeaton-react-prosemirror-v0.22.10-gitpkg",
Expand Down Expand Up @@ -62,12 +125,15 @@
"@types/react-dom": "^16.9.4",
"@types/react-transition-group": "^4.2.3",
"@types/throttle-debounce": "^2.1.0",
"cross-env": "^6.0.3",
"electron": "^7.1.2",
"electron-builder": "^21.2.0",
"electron-notarize": "^0.2.1",
"electron-react-devtools": "^0.5.3",
"electron-webpack": "^2.7.4",
"electron-webpack-ts": "^3.2.0",
"node-sass": "^4.12.0",
"npm-run-all": "^4.1.5",
"sass-loader": "^7.1.0",
"typescript": "^3.7.2",
"webpack": "~4.35.2"
Expand Down
49 changes: 49 additions & 0 deletions scripts/hooks/after-sign.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// See: https://medium.com/@TwitterArchiveEraser/notarize-electron-apps-7a5f988406db

const fs = require('fs');
const path = require('path');
var electron_notarize = require('electron-notarize');

module.exports = async function notarize(params) {
// Only notarize the app on macOS
if (process.platform !== 'darwin') {
return;
}
console.log('afterSign hook triggered', params);

if (process.env.NODE_ENV === 'development') {
return console.warn('Skipping notarization, NODE_ENV=development');
}

// Use the same appId as specified in electron-builder configuration
let appId = 'org.ituob.editor';

let appPath = path.join(
params.appOutDir,
`${params.packager.appInfo.productFilename}.app`
);
if (!fs.existsSync(appPath)) {
throw new Error(`Cannot find application at: ${appPath}`);
}

console.log(`Notarizing ${appId} found at ${appPath}`);

let appleId = process.env.AID
if (!appleId) throw new Error('No Apple ID found ($AID variable)');

let appleIdPassword = process.env.AIP
if (!appleIdPassword) throw new Error('No Apple ID password found ($AIP variable)');

try {
await electron_notarize.notarize({
appBundleId: appId,
appPath: appPath,
appleId: appleId,
appleIdPassword: appleIdPassword,
});
} catch (error) {
console.error(`Failed to notarize: ${err ? err.message : 'error message not specified'}`);
}

console.log(`Done notarizing ${appId}`);
};
Loading

0 comments on commit 50f8d4e

Please sign in to comment.