Skip to content

JayBizzle/electron-gh-releases

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Electron-gh-releases Build Status js-standard-style

Auto-update for electron apps using Github releases together with the built-in auto-updater.

This is OS X only.

Install

npm install --save electron-gh-releases

Usage

Tip

Use electron-release to publish new releases to Github from the CLI.

auto_updater.json

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.

When publishing a new release on Github

  1. The tag needs to be a valid semver version.
  2. Your .app must be signed and zip compressed.

Checking and installing updates

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()
  }
})

Docs

Constructor

new gh_releases([options], [callback])

options

repo - String Your github repo in the format: USERNAME/REPO_NAME

currentVersion - Semver version

callback(auto_updater)

Returns the auto_updater instance.

Methods

.check([callback])

Checks for new releases on Github.

callback(err, status)

err - String Contains errors, if any.

status - Boolean Is true if a new version is available.

.download()

Runs Electrons checkForUpdates() method. This method should only be called if check() returns true.

Tests

npm test

License

MIT

About

Electron auto-update by releasing on Github.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%