This commit is contained in:
riqo 2021-04-13 07:28:12 -05:00
commit d739349004
6 changed files with 86 additions and 17 deletions

View file

@ -11,5 +11,4 @@ build:
paths:
- $CI_PROJECT_DIR/dist/*.*
script:
- sed "s/0.0.0/${VERSION_ID}/g" package.json > _package.json && mv _package.json package.json
- yarn && yarn electron:build
- yarn dist

51
electron.builder.yml Normal file
View file

@ -0,0 +1,51 @@
electronVersion: 9.0.0
compression: normal
npmRebuild: false
# TODO: enable this in the future once we sign all the linux builds.
#forceCodeSigning: true
directories:
output: dist
buildResources: build
app: .
mac:
category: Reference
icon: ./icons/icon.icns
target:
- target: dmg
- target: zip
# steps for notarizing the MacOS builds:
# https://kilianvalkhof.com/2019/electron/notarizing-your-electron-application/
hardenedRuntime: true
gatekeeperAssess: false
entitlements: build/macos/entitlements.mac.plist
entitlementsInherit: build/macos/entitlements.mac.plist
dmg:
# The inner app inside the .dmg is signed and there is some broken logic
# which requires that the DMG itself is not signed.
sign: false
nsis:
artifactName: ${name}-${version}-${arch}.${ext}
appx:
artifactName: ${name}-${version}-${arch}.${ext}
applicationId: polar
identityName: 25130KevinBurton.PolarBookshelf
publisher: CN=D3591277-F57D-4C75-B342-D158E6C4AAF5
publisherDisplayName: Kevin Burton
# https://www.electron.build/configuration/publish
# https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
publish:
provider: github
publishAutoUpdate: true
asar: true
afterPack: "./electron-builder-afterpack.js"
afterSign: "./build/macos/notarize.js"

View file

@ -7,7 +7,7 @@
"author": {
"name": "Enrique Hernandez"
},
"main": "background.js",
"main": "./src/background.ts",
"scripts": {
"dev": "yarn electron:serve",
"serve": "vue-cli-service serve",
@ -17,7 +17,8 @@
"electron:build": "vue-cli-service electron:build",
"electron:serve": "vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"postuninstal": "electron-builder install-app-deps"
"postuninstal": "electron-builder install-app-deps",
"dist":"electron-builder --publish always"
},
"dependencies": {
"@google-cloud/speech": "^4.2.0",

View file

@ -82,6 +82,13 @@ export default defineComponent({
onMounted(() => {
console.log("APP:mounted.")
window.ipcRenderer.on("update-state", updateState)
window.ipcRenderer.on("update_available", () => {
console.log('testing auto update');
})
window.ipcRenderer.on("update_downloaded", () => {
console.log('testing update download');
})
post("app-mounted", "")
});

View file

@ -4,8 +4,9 @@
import { app } from "electron";
import { createWindow } from './window';
import { initSession } from './session';
import { initAudioIO, stopStream } from './audio';
import { initAudioIO } from './audio';
import { backgroundMitt } from '@/modules/emitter';
const { autoUpdater } = require('electron-updater');
let win: boolean;

View file

@ -6,6 +6,7 @@ import { backgroundMitt } from '@/modules/emitter';
import { RenderMessage, WindowState } from "@/types";
import { loadWinState, saveToJson } from "./helpers";
import * as path from "path";
const { autoUpdater } = require('electron-updater');
interface IpcRendererPayload {
endpoint: string;
@ -124,6 +125,7 @@ export async function createWindow(): Promise<void> {
win.on("resize", saveWindowState);
win.once('ready-to-show', () => {
autoUpdater.checkForUpdatesAndNotify();
if (win) win.show()
})
@ -139,3 +141,11 @@ export async function createWindow(): Promise<void> {
});
}
autoUpdater.on('update-available', () => {
if (win) win.webContents.send('update_available');
});
autoUpdater.on('update-downloaded', () => {
if (win) win.webContents.send('update_downloaded');
});