Skip to content

Commit 3a2ae71

Browse files
Michael Borckclaude
andcommitted
feat: auto-update from GitHub releases via electron-updater
- checkForUpdatesAndNotify on launch (production only); downloads in the background and applies on next start - mac builds add the zip target electron-updater requires - release workflow uploads latest*.yml metadata, zips, and blockmaps Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent dcacdf6 commit 3a2ae71

4 files changed

Lines changed: 118 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ jobs:
8282
files: |
8383
dist/*.exe
8484
dist/*.dmg
85+
dist/*.zip
8586
dist/*.AppImage
8687
dist/*.deb
8788
dist/*.rpm
89+
dist/*.blockmap
90+
dist/latest*.yml
8891
generate_release_notes: true
8992
draft: false
9093
prerelease: false

main.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,25 @@ async function createWindow() {
135135
});
136136
}
137137

138+
// Check GitHub releases for updates; downloads in the background and
139+
// notifies the user once the update is ready (applied on next launch).
140+
function checkForUpdates() {
141+
if (isDev) return;
142+
try {
143+
const { autoUpdater } = require('electron-updater');
144+
autoUpdater.checkForUpdatesAndNotify().catch((err) => {
145+
console.error('Auto-update check failed:', err);
146+
});
147+
} catch (err) {
148+
console.error('Auto-updater unavailable:', err);
149+
}
150+
}
151+
138152
// App event handlers
139-
app.whenReady().then(createWindow);
153+
app.whenReady().then(() => {
154+
createWindow();
155+
checkForUpdates();
156+
});
140157

141158
app.on('window-all-closed', () => {
142159
// Close the server when all windows are closed

package-lock.json

Lines changed: 89 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"@headlessui/react": "^2.1.2",
2727
"@mozilla/readability": "^0.5.0",
2828
"@xenova/transformers": "^2.17.2",
29+
"electron-updater": "^6.8.9",
2930
"eventsource-parser": "^1.1.2",
3031
"get-port": "^6.1.2",
3132
"jsdom": "^24.1.0",
@@ -88,6 +89,13 @@
8889
"x64",
8990
"arm64"
9091
]
92+
},
93+
{
94+
"target": "zip",
95+
"arch": [
96+
"x64",
97+
"arm64"
98+
]
9199
}
92100
]
93101
},

0 commit comments

Comments
 (0)