fix: auto update on windows
This commit is contained in:
parent
97bd60135e
commit
0e25ddda01
2 changed files with 19 additions and 1 deletions
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
|
@ -170,6 +170,7 @@ jobs:
|
|||
path: |
|
||||
apps/desktop/out/make/squirrel.windows/${{ matrix.arch }}/*.exe
|
||||
apps/desktop/out/make/squirrel.windows/${{ matrix.arch }}/*.nupkg
|
||||
apps/desktop/out/make/squirrel.windows/${{ matrix.arch }}/RELEASES
|
||||
|
||||
release:
|
||||
name: Create Release
|
||||
|
|
@ -241,5 +242,6 @@ jobs:
|
|||
artifacts/macos-x64/zip/darwin/x64/*.zip
|
||||
artifacts/windows-x64/*.exe
|
||||
artifacts/windows-x64/*.nupkg
|
||||
artifacts/windows-x64/RELEASES
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
|||
|
|
@ -6,11 +6,17 @@ import { app } from "electron";
|
|||
import started from "electron-squirrel-startup";
|
||||
import { AppManager } from "./core/app-manager";
|
||||
import { updateElectronApp } from "update-electron-app";
|
||||
import { isWindows } from "../utils/platform";
|
||||
|
||||
if (started) {
|
||||
app.quit();
|
||||
}
|
||||
|
||||
// Set App User Model ID for Windows (required for Squirrel.Windows)
|
||||
if (isWindows()) {
|
||||
app.setAppUserModelId("com.amical.desktop");
|
||||
}
|
||||
|
||||
// Enforce single instance
|
||||
const gotTheLock = app.requestSingleInstanceLock();
|
||||
|
||||
|
|
@ -20,9 +26,19 @@ if (!gotTheLock) {
|
|||
}
|
||||
|
||||
// Set up auto-updater for production builds
|
||||
if (app.isPackaged) {
|
||||
if (app.isPackaged && !isWindows()) {
|
||||
updateElectronApp();
|
||||
}
|
||||
if (app.isPackaged && isWindows()) {
|
||||
// Check if running with --squirrel-firstrun (Windows only)
|
||||
const isSquirrelFirstRun = process.argv.includes("--squirrel-firstrun");
|
||||
// Delay update check on Windows to avoid Squirrel file lock issues
|
||||
if (isWindows() && !isSquirrelFirstRun) {
|
||||
setTimeout(() => {
|
||||
updateElectronApp();
|
||||
}, 60000); // 60 second delay
|
||||
}
|
||||
}
|
||||
|
||||
const appManager = new AppManager();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue