Your GitWidget app now has full auto-update functionality! Here's how it works and how to use it.
- Auto-updater integration - Checks for updates on startup
- GitHub Actions workflow - Automatically builds and publishes releases
- Update notification UI - Shows users when updates are available
- Progress tracking - Visual feedback during download
- Automatic installation - Updates install and restart the app
- App automatically checks for updates when it starts
- If an update is available, a notification appears at the top
- Users can download and install updates with one click
- App automatically restarts after installation
- Push code changes to your repository
- Create a new version tag (e.g.,
v1.0.1,v1.2.0) - GitHub Actions automatically builds and releases the app
- All users receive the update automatically
# In package.json, bump the version
"version": "1.0.1" # Change this to your new versiongit add .
git commit -m "feat: Add new feature or fix"
git push origin main# Create and push a version tag
git tag v1.0.1
git push origin v1.0.1- GitHub Actions will automatically build your app for Windows, Mac, and Linux
- Release files will be published to GitHub Releases
- Users will get notified of the update
- Update Check: On app startup (production only)
- Auto Install: 5 seconds after download completes
- Platforms: Windows, macOS, Linux
- Distribution: GitHub Releases
In src/main/index.ts, you can modify when updates are checked:
// Check every hour
setInterval(() => {
autoUpdater.checkForUpdatesAndNotify();
}, 60 * 60 * 1000);
// Check only manually
// Remove autoUpdater.checkForUpdatesAndNotify() from app.whenReady()In src/main/index.ts, modify the timeout:
autoUpdater.on('update-downloaded', (info) => {
if (mainWindow) {
mainWindow.webContents.send('update-downloaded', info);
}
// Change from 5 seconds to 30 seconds
setTimeout(() => {
autoUpdater.quitAndInstall();
}, 30000);
});# Build a test version
npm run build:win
# Install it, then create a new version and test the update- Create pre-release tags:
v1.0.1-beta - Test with a small group before public release
- Use
draft: truein GitHub Actions for testing
v1.0.0- Major releasev1.0.1- Bug fixv1.1.0- New featuresv2.0.0- Breaking changesv1.0.1-beta- Pre-release
- Check if version in package.json matches the tag
- Verify GitHub Actions completed successfully
- Check GitHub Releases for published files
- Check GitHub Actions logs
- Ensure all dependencies are in package.json
- Verify GitHub token permissions
Users can manually trigger update checks through the update notification component.
- Updates are signed with GitHub's certificate
- Only downloads from your GitHub repository
- Users see the version and can verify updates
- No auto-update in development mode
- Push changes: Make your changes and push to GitHub
- Tag version: Create a version tag like
v1.0.1 - Auto-build: GitHub Actions builds for all platforms
- Auto-distribute: Releases published to GitHub
- Auto-notify: Users get update notifications
- Auto-install: Updates install automatically
Your app now has enterprise-grade auto-update functionality! 🎉