| name | electron-auto-updater-setup |
| description | Configure electron-updater with code signing verification, delta updates, staged rollouts, and multiple update channels for Electron applications |
| allowed-tools | Read, Write, Edit, Bash, Glob, Grep |
| tags | ["electron","desktop","auto-update","deployment","releases"] |
| graph | {"domains":["domain:software-engineering"],"specializations":["specialization:desktop-development"],"skillAreas":["skill-area:desktop-ui-frameworks","skill-area:deployment-infrastructure-management"],"roles":["role:desktop-developer","role:fullstack-engineer"],"workflows":["workflow:feature-development","workflow:release-management"]} |
electron-auto-updater-setup
Configure electron-updater for Electron applications with advanced features including code signing verification, delta updates, staged rollouts, and multiple release channels. This skill creates a complete auto-update infrastructure.
Capabilities
- Configure electron-updater with multiple providers (GitHub, S3, Generic, Spaces)
- Set up staged rollouts with percentage-based distribution
- Configure delta (differential) updates for efficient bandwidth usage
- Implement multiple release channels (stable, beta, alpha)
- Set up code signing verification for update packages
- Create update notification UI components
- Configure silent updates vs. interactive updates
- Implement rollback mechanisms
Input Schema
{
"type": "object",
"properties": {
"projectPath": {
"type": "string",
"description": "Path to the Electron project root"
},
"provider": {
"type": "object",
"properties": {
"type": { "enum": ["github", "s3", "generic", "spaces", "keygen"] },
"config": {
"type": "object",
"description": "Provider-specific configuration"
Output Schema
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"files": {
"type": "array",
"items": {
"type": "object",
"properties": {
"path": { "type": "string" },
"type": { "enum": ["config", "main", "ui", "ipc", "utils"] }
}
Generated File Structure
src/
main/
updater/
auto-updater.ts # Main updater logic
update-channels.ts # Channel management
staged-rollout.ts # Staged rollout logic
delta-updates.ts # Delta update handling
preload/
updater-api.ts # Exposed updater API
renderer/
components/
UpdateNotification/ # UI components
UpdateNotification.tsx
UpdateProgress.tsx
ReleaseNotes.tsx
shared/
update-types.ts # TypeScript types
Code Templates
Main Auto-Updater Module
import { autoUpdater, UpdateInfo } from 'electron-updater';
import { app, BrowserWindow, ipcMain } from 'electron';
import log from 'electron-log';
autoUpdater.logger = log;
autoUpdater.logger.transports.file.level = 'info';
autoUpdater.autoDownload = false;
autoUpdater.autoInstallOnAppQuit = true;
export class AppUpdater {
private mainWindow: BrowserWindow | null = null;
constructor(mainWindow: BrowserWindow) {
this.mainWindow = mainWindow;
this.setupEventHandlers();
this.setupIpcHandlers();
}
private setupEventHandlers() {
autoUpdater.on('checking-for-update', () => {
this.sendToRenderer(, { : });
});
autoUpdater.(, {
.(, {
: ,
: info.,
: info.,
: info.,
});
});
autoUpdater.(, {
.(, { : });
});
autoUpdater.(, {
.(, {
: progress.,
: progress.,
: progress.,
: progress.,
});
});
autoUpdater.(, {
.(, {
: ,
: info.,
});
});
autoUpdater.(, {
.(, {
: ,
: error.,
});
});
}
() {
ipcMain.(, () => {
autoUpdater.();
});
ipcMain.(, () => {
autoUpdater.();
});
ipcMain.(, {
autoUpdater.(, );
});
ipcMain.(, (_, : ) => {
autoUpdater. = channel;
autoUpdater.();
});
}
() {
.?..(channel, data);
}
() {
autoUpdater.();
}
}
Staged Rollout Implementation
import { machineIdSync } from 'node-machine-id';
import crypto from 'crypto';
export class StagedRollout {
private machineId: string;
private rolloutPercentage: number;
constructor() {
this.machineId = machineIdSync();
this.rolloutPercentage = 100;
}
shouldReceiveUpdate(version: string, rolloutPercentage: number): boolean {
const hash = crypto
.createHash('sha256')
.update(`${this.machineId}:${version}`)
.digest('hex');
const hashNumber = parseInt(hash.substring(0, 8), 16);
bucket = (hashNumber / ) * ;
bucket < rolloutPercentage;
}
() {
{
response = (
);
config = response.();
config. || ;
} {
;
}
}
}
Multi-Channel Support
import { autoUpdater } from 'electron-updater';
import Store from 'electron-store';
const store = new Store();
export const UPDATE_CHANNELS = ['stable', 'beta', 'alpha'] as const;
export type UpdateChannel = typeof UPDATE_CHANNELS[number];
export function getUpdateChannel(): UpdateChannel {
return store.get('updateChannel', 'stable') as UpdateChannel;
}
export function setUpdateChannel(channel: UpdateChannel) {
if (!UPDATE_CHANNELS.includes(channel)) {
throw new Error(`Invalid channel: ${channel}`);
}
store.set('updateChannel', channel);
autoUpdater.channel = channel;
autoUpdater.();
}
() {
channel = ();
autoUpdater. = channel;
autoUpdater. = channel !== ;
}
Update UI Component (React)
import React, { useEffect, useState } from 'react';
interface UpdateStatus {
status: 'checking' | 'available' | 'not-available' | 'downloading' | 'downloaded' | 'error';
version?: string;
releaseNotes?: string;
error?: string;
}
interface UpdateProgress {
percent: number;
bytesPerSecond: number;
transferred: number;
total: number;
}
export function UpdateNotification() {
const [status, setStatus] = useState<UpdateStatus | null>(null);
const [progress, setProgress] = useState<UpdateProgress | null>(null);
useEffect(() => {
const unsubStatus = window.electronAPI.on('update-status', setStatus);
const unsubProgress = window.electronAPI.(, setProgress);
{
();
();
};
}, []);
= () => {
..();
};
= () => {
..();
};
(!status || status. === ) ;
(
);
}
Provider Configurations
GitHub Releases
publish:
provider: github
owner: your-org
repo: your-repo
releaseType: release
private: false
Amazon S3
publish:
provider: s3
bucket: your-bucket
region: us-east-1
acl: public-read
path: /releases/${os}/${arch}
Generic Server
publish:
provider: generic
url: https://updates.example.com/releases
channel: latest
DigitalOcean Spaces
publish:
provider: spaces
name: your-space
region: nyc3
Environment Variables
| Variable | Description | Required |
|---|
GH_TOKEN | GitHub personal access token | For GitHub provider |
AWS_ACCESS_KEY_ID | AWS access key | For S3 provider |
AWS_SECRET_ACCESS_KEY | AWS secret key | For S3 provider |
DO_SPACES_KEY | DigitalOcean Spaces key | For Spaces provider |
DO_SPACES_SECRET | DigitalOcean Spaces secret | For Spaces provider |
Testing Auto-Updates
DEBUG=electron-updater npm run dev
ELECTRON_FORCE_DEV_UPDATE_CONFIG=true npm run dev
npm run build -- --publish never
Best Practices
- Always sign updates - Verify code signatures before installing
- Use delta updates - Reduce bandwidth for large applications
- Implement staged rollouts - Catch issues before full deployment
- Provide release notes - Users appreciate knowing what changed
- Test rollback scenarios - Ensure users can recover from bad updates
- Monitor update analytics - Track adoption rates and failures
Community References
Related Skills
electron-builder-config - Build configuration
electron-main-preload-generator - Main/preload scripts
sentry-desktop-setup - Crash reporting for update issues
Related Agents
electron-architect - Electron best practices
release-manager - Release coordination