merging
This commit is contained in:
commit
c3be798dda
9 changed files with 198 additions and 44 deletions
60
.gitlab-ci.yml
Normal file
60
.gitlab-ci.yml
Normal file
|
|
@ -0,0 +1,60 @@
|
||||||
|
stages:
|
||||||
|
- Build
|
||||||
|
- Upload
|
||||||
|
- Release
|
||||||
|
|
||||||
|
build:
|
||||||
|
stage: Build
|
||||||
|
image: electronuserland/builder:wine
|
||||||
|
before_script:
|
||||||
|
- yarn
|
||||||
|
script:
|
||||||
|
- export VERSION=$(node -e "console.log(require('./package.json').version)")
|
||||||
|
- echo "VERSION=$VERSION" >> variables.env
|
||||||
|
- export APPNAME=$(node -e "console.log(require('./package.json').productName)")
|
||||||
|
- echo "APPNAME=$APPNAME" >> variables.env
|
||||||
|
- yarn build
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
dotenv: variables.env
|
||||||
|
name: $CI_COMMIT_REF_SLUG
|
||||||
|
paths:
|
||||||
|
- $CI_PROJECT_DIR/dist/*.*
|
||||||
|
when: on_success
|
||||||
|
only:
|
||||||
|
- main
|
||||||
|
|
||||||
|
variables:
|
||||||
|
WIN_BINARY: '${APPNAME}-${VERSION}.exe'
|
||||||
|
PACKAGE_REGISTRY_URL: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${APPNAME}/${VERSION}'
|
||||||
|
|
||||||
|
upload:
|
||||||
|
stage: Upload
|
||||||
|
needs:
|
||||||
|
- job: build
|
||||||
|
artifacts: true
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: never # Do not run this job when a tag is created manually
|
||||||
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when when commits are pushed to the default branch
|
||||||
|
script:
|
||||||
|
- 'curl --header "JOB-TOKEN: $CI_DEPLOY_PASSWORD" --upload-file "./dist/${WIN_BINARY}" "${PACKAGE_REGISTRY_URL}/${WIN_BINARY}"'
|
||||||
|
|
||||||
|
auto-release-master:
|
||||||
|
image: registry.gitlab.com/gitlab-org/release-cli
|
||||||
|
needs:
|
||||||
|
- job: build
|
||||||
|
artifacts: true
|
||||||
|
- job: upload
|
||||||
|
artifacts: true
|
||||||
|
stage: Release
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: never # Do not run this job when a tag is created manually
|
||||||
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when when commits are pushed to the default branch
|
||||||
|
script:
|
||||||
|
- echo "Release $VERSION"
|
||||||
|
- |
|
||||||
|
release-cli create --name "Release $VERSION" --tag-name v$VERSION \
|
||||||
|
--description 'Created using the release-cli. $CI_COMMIT_TITLE' --ref $CI_COMMIT_SHA \
|
||||||
|
--assets-link "{\"name\":\"${APPNAME}\",\"url\":\"${PACKAGE_REGISTRY_URL}/${WIN_BINARY}\"}"
|
||||||
51
electron.builder.yml
Normal file
51
electron.builder.yml
Normal 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"
|
||||||
36
package.json
36
package.json
|
|
@ -7,10 +7,41 @@
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Enrique Hernandez"
|
"name": "Enrique Hernandez"
|
||||||
},
|
},
|
||||||
"main": "background.js",
|
"main": "./src/background.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vue-cli-service electron:serve",
|
"dev": "vue-cli-service electron:serve",
|
||||||
"build": "vue-cli-service electron:build"
|
"serve": "vue-cli-service serve",
|
||||||
|
"build": "electron-builder --win",
|
||||||
|
"test:unit": "vue-cli-service test:unit",
|
||||||
|
"lint": "vue-cli-service lint",
|
||||||
|
"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",
|
||||||
|
"dist": "electron-builder --publish always"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://gitlab.com/crimata/electron-app.git",
|
||||||
|
"release": "latest"
|
||||||
|
},
|
||||||
|
"build": {
|
||||||
|
"artifactName": "${productName}-${version}.${ext}",
|
||||||
|
"publish": {
|
||||||
|
"provider": "generic",
|
||||||
|
"url": "https://gitlab.com/api/v4/projects/25637892/jobs/artifacts/master/raw/dist?job=build"
|
||||||
|
},
|
||||||
|
"win": {
|
||||||
|
"target": [
|
||||||
|
"nsis"
|
||||||
|
],
|
||||||
|
"verifyUpdateCodeSignature": false
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"target": [
|
||||||
|
"AppImage"
|
||||||
|
]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@google-cloud/speech": "^4.2.0",
|
"@google-cloud/speech": "^4.2.0",
|
||||||
|
|
@ -51,6 +82,7 @@
|
||||||
"@wasm-tool/wasm-pack-plugin": "^1.3.1",
|
"@wasm-tool/wasm-pack-plugin": "^1.3.1",
|
||||||
"electron": "^9.0.0",
|
"electron": "^9.0.0",
|
||||||
"electron-devtools-installer": "^3.1.0",
|
"electron-devtools-installer": "^3.1.0",
|
||||||
|
"electron-log": "^4.3.4",
|
||||||
"eslint": "^6.7.2",
|
"eslint": "^6.7.2",
|
||||||
"eslint-plugin-vue": "^7.0.0-0",
|
"eslint-plugin-vue": "^7.0.0-0",
|
||||||
"lint-staged": "^9.5.0",
|
"lint-staged": "^9.5.0",
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,13 @@ export default defineComponent({
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
console.log("APP:mounted.")
|
console.log("APP:mounted.")
|
||||||
window.ipcRenderer.on("update-state", updateState)
|
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", "")
|
post("app-mounted", "")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,11 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
import { protocol, autoUpdater, dialog } from "electron";
|
const log = require("electron-log")
|
||||||
|
const { autoUpdater } = require('electron-updater')
|
||||||
|
|
||||||
import { initApp } from './background/init';
|
import { initApp } from './background/init';
|
||||||
|
import { protocol, dialog } from "electron";
|
||||||
|
|
||||||
// Scheme must be registered before the app is ready
|
// Scheme must be registered before the app is ready
|
||||||
protocol.registerSchemesAsPrivileged([
|
protocol.registerSchemesAsPrivileged([
|
||||||
|
|
@ -18,36 +21,20 @@ const isDev = require('electron-is-dev');
|
||||||
|
|
||||||
// NOTE Program Begins Here
|
// NOTE Program Begins Here
|
||||||
(async () => {
|
(async () => {
|
||||||
|
autoUpdater.requestHeaders = { 'PRIVATE-TOKEN': 'seMF_apn237iUw8puG9a' }
|
||||||
|
autoUpdater.logger = log;
|
||||||
|
|
||||||
|
// Check for an update 10sec after Program Starts
|
||||||
|
setTimeout(function () {
|
||||||
|
autoUpdater.checkForUpdatesAndNotify()
|
||||||
|
}, 10000)
|
||||||
|
|
||||||
|
// Check for an update every 2min.
|
||||||
|
setInterval(() => {
|
||||||
|
autoUpdater.checkForUpdatesAndNotify()
|
||||||
|
}, 120000)
|
||||||
|
|
||||||
console.log('Starting Crimata electron app.');
|
console.log('Starting Crimata electron app.');
|
||||||
initApp(isDev);
|
initApp(isDev);
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
// Code for auto app updates.
|
|
||||||
if (!isDev) {
|
|
||||||
|
|
||||||
autoUpdater.setFeedURL({
|
|
||||||
url: "https://gitlab.com/api/v4/projects/25637892/releases",
|
|
||||||
headers: {"PRIVATE-TOKEN": "fSCN8xr4EgccV7z1UNaw"},
|
|
||||||
serverType: "default"
|
|
||||||
})
|
|
||||||
|
|
||||||
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
|
||||||
const dialogOpts = {
|
|
||||||
type: 'info',
|
|
||||||
buttons: ['Restart', 'Later'],
|
|
||||||
title: 'Application Update',
|
|
||||||
message: process.platform === 'win32' ? releaseNotes : releaseName,
|
|
||||||
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
|
|
||||||
}
|
|
||||||
|
|
||||||
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
|
||||||
if (returnValue.response === 0) autoUpdater.quitAndInstall()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
setInterval(() => {
|
|
||||||
autoUpdater.checkForUpdates()
|
|
||||||
}, 5000)
|
|
||||||
}
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { createWindow } from './window';
|
||||||
import { initSession } from './session';
|
import { initSession } from './session';
|
||||||
import { initAudioIO } from './audio';
|
import { initAudioIO } from './audio';
|
||||||
import { backgroundMitt } from '@/modules/emitter';
|
import { backgroundMitt } from '@/modules/emitter';
|
||||||
|
const { autoUpdater } = require('electron-updater');
|
||||||
|
|
||||||
let win: boolean;
|
let win: boolean;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { backgroundMitt } from '@/modules/emitter';
|
||||||
import { RenderMessage, WindowState } from "@/types";
|
import { RenderMessage, WindowState } from "@/types";
|
||||||
import { loadWinState, saveToJson } from "./helpers";
|
import { loadWinState, saveToJson } from "./helpers";
|
||||||
import * as path from "path";
|
import * as path from "path";
|
||||||
|
const { autoUpdater } = require('electron-updater');
|
||||||
|
|
||||||
interface IpcRendererPayload {
|
interface IpcRendererPayload {
|
||||||
endpoint: string;
|
endpoint: string;
|
||||||
|
|
@ -124,6 +125,7 @@ export async function createWindow(): Promise<void> {
|
||||||
win.on("resize", saveWindowState);
|
win.on("resize", saveWindowState);
|
||||||
|
|
||||||
win.once('ready-to-show', () => {
|
win.once('ready-to-show', () => {
|
||||||
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
if (win) win.show()
|
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');
|
||||||
|
});
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,8 @@ module.exports = {
|
||||||
builderOptions: {
|
builderOptions: {
|
||||||
// TODO electron-builder config https://www.electron.build/configuration/configuration
|
// TODO electron-builder config https://www.electron.build/configuration/configuration
|
||||||
appId: "com.crimata.messenger",
|
appId: "com.crimata.messenger",
|
||||||
productName: "Crimata Messenger"
|
productName: "Crimata Messenger",
|
||||||
|
|
||||||
},
|
},
|
||||||
preload: "src/preload.ts"
|
preload: "src/preload.ts"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5126,6 +5126,11 @@ electron-is-dev@^2.0.0:
|
||||||
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-2.0.0.tgz#833487a069b8dad21425c67a19847d9064ab19bd"
|
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-2.0.0.tgz#833487a069b8dad21425c67a19847d9064ab19bd"
|
||||||
integrity sha512-3X99K852Yoqu9AcW50qz3ibYBWY79/pBhlMCab8ToEWS48R0T9tyxRiQhwylE7zQdXrMnx2JKqUJyMPmt5FBqA==
|
integrity sha512-3X99K852Yoqu9AcW50qz3ibYBWY79/pBhlMCab8ToEWS48R0T9tyxRiQhwylE7zQdXrMnx2JKqUJyMPmt5FBqA==
|
||||||
|
|
||||||
|
electron-log@^4.3.4:
|
||||||
|
version "4.3.4"
|
||||||
|
resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-4.3.4.tgz#97e991dcd653e759e14eb2ae5d6ba4440f50afd8"
|
||||||
|
integrity sha512-Cd6xZ9if2J4NG+PNoi3cARAYoanbM4ddpod0faaL5LIhmwuSdxP9XH95C9SgTpHMqklbg8u3CFh1yqiaqo2Bng==
|
||||||
|
|
||||||
electron-publish@22.9.1:
|
electron-publish@22.9.1:
|
||||||
version "22.9.1"
|
version "22.9.1"
|
||||||
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-22.9.1.tgz#7cc76ac4cc53efd29ee31c1e5facb9724329068e"
|
resolved "https://registry.yarnpkg.com/electron-publish/-/electron-publish-22.9.1.tgz#7cc76ac4cc53efd29ee31c1e5facb9724329068e"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue