From 72e5a35c2620e1b831890c66de6d6aa70d1ad0cd Mon Sep 17 00:00:00 2001 From: kangfenmao Date: Fri, 12 Jul 2024 16:24:27 +0800 Subject: [PATCH] feat: add autoUpdater --- electron-builder.yml | 5 +++-- src/main/index.ts | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/electron-builder.yml b/electron-builder.yml index 6be24595..e460b4b7 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -39,8 +39,9 @@ appImage: artifactName: ${name}-${version}.${ext} npmRebuild: false publish: - provider: generic - url: https://example.com/auto-updates + provider: github + repo: cherry-studio + owner: kangfenmao electronDownload: mirror: https://npmmirror.com/mirrors/electron/ afterSign: scripts/notarize.js diff --git a/src/main/index.ts b/src/main/index.ts index eceaa7f7..80d98e03 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -4,6 +4,7 @@ import windowStateKeeper from 'electron-window-state' import { join } from 'path' import icon from '../../resources/icon.png?asset' import installExtension, { REDUX_DEVTOOLS } from 'electron-devtools-installer' +import { autoUpdater } from 'electron-updater' function createWindow(): void { // Load the previous state with fallback to defaults @@ -102,5 +103,7 @@ app.on('window-all-closed', () => { } }) +autoUpdater.checkForUpdatesAndNotify() + // In this file you can include the rest of your app"s specific main process // code. You can also put them in separate files and require them here.