Auto-update for electron apps using Github releases together with the built-in auto-updater.
This is OS X only.
npm install --save electron-gh-releases
Tip
Use electron-release to publish new releases to Github from the CLI.
A file named auto_updater.json
needs to be placed in the root of your repo.
This file should contain at least a url
key, pointing to the .zip
file URL in your latest release.
Look here for valid keys.
- The tag needs to be a valid semver version.
- Your
.app
must be signed andzip
compressed.
var gh_releases = require('electron-gh-releases')
var options = {
repo: 'jenslind/electron-gh-releases',
currentVersion: app.getVersion()
}
var update = new gh_releases(options, function (auto_updater) {
// Auto updater event listener
auto_updater.on('update-downloaded', function (e, rNotes, rName, rDate, uUrl, quitAndUpdate) {
// Install the update
quitAndUpdate()
})
})
// Check for updates
update.check(function (err, status) {
if (!err && status) {
update.download()
}
})
repo
- String Your github repo in the format: USERNAME/REPO_NAME
currentVersion
- Semver version
Returns the auto_updater instance.
Checks for new releases on Github.
err
- String Contains errors, if any.
status
- Boolean Is true if a new version is available.
Runs Electrons checkForUpdates() method. This method should only be called if check() returns true.
npm test
MIT