Add desktop (Electron) packaging and release distribution (#1147)
* Add desktop packaging workflow * Add desktop package homepage * Fix desktop default credential prompt * Suppress default credential prompt on desktop * Publish desktop artifacts on release; reduce CI to PR smoke test Add desktop-release.yml triggered on release publish (mirroring docker-publish.yml) to build all platforms and upload .dmg/.exe/ .AppImage/.deb to the GitHub Release. Trim build.yml desktop job to a PR-only Linux x64 smoke test, since release artifacts are now produced by desktop-release.yml. This drops per-push and macOS/Windows packaging from regular CI. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * Fix desktop Hermes data home on Windows --------- Co-authored-by: xingzhi <chuzihao.czh@alibaba-inc.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import { app, dialog } from 'electron'
|
||||
import { autoUpdater } from 'electron-updater'
|
||||
|
||||
let initialized = false
|
||||
|
||||
export function initAutoUpdater() {
|
||||
if (initialized) return
|
||||
initialized = true
|
||||
|
||||
if (!app.isPackaged) return // dev mode: skip
|
||||
if (process.env.HERMES_DESKTOP_ENABLE_AUTO_UPDATE !== 'true') return
|
||||
|
||||
autoUpdater.autoDownload = true
|
||||
autoUpdater.autoInstallOnAppQuit = true
|
||||
|
||||
autoUpdater.on('update-available', info => {
|
||||
console.log(`[updater] update available: ${info.version}`)
|
||||
})
|
||||
autoUpdater.on('update-not-available', () => {
|
||||
console.log('[updater] up to date')
|
||||
})
|
||||
autoUpdater.on('error', err => {
|
||||
console.error('[updater] error:', err)
|
||||
})
|
||||
autoUpdater.on('update-downloaded', async info => {
|
||||
const { response } = await dialog.showMessageBox({
|
||||
type: 'info',
|
||||
title: 'Update ready',
|
||||
message: `Hermes Desktop ${info.version} is ready to install.`,
|
||||
detail: 'Restart now to apply the update, or it will be installed on next quit.',
|
||||
buttons: ['Restart now', 'Later'],
|
||||
defaultId: 0,
|
||||
cancelId: 1,
|
||||
})
|
||||
if (response === 0) autoUpdater.quitAndInstall()
|
||||
})
|
||||
|
||||
autoUpdater.checkForUpdates().catch(err => {
|
||||
console.error('[updater] initial check failed:', err)
|
||||
})
|
||||
|
||||
// Recheck every 6h while app is running
|
||||
setInterval(() => {
|
||||
autoUpdater.checkForUpdates().catch(() => undefined)
|
||||
}, 6 * 60 * 60 * 1000)
|
||||
}
|
||||
Reference in New Issue
Block a user