Skip to content

Commit

Permalink
Version 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
iffy committed Nov 1, 2017
1 parent 652865c commit 2d4aaee
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 39 deletions.
27 changes: 19 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,35 @@ If you can't use GitHub, you can use other providers:

npm install

4. Generate a GitHub access token by going to <https://github.com/settings/tokens/new>. The access token should have the `repo` scope/permission. Once you have the token, assign it to an environment variable
4. Generate a GitHub access token by going to <https://github.com/settings/tokens/new>. The access token should have the `repo` scope/permission. Once you have the token, assign it to an environment variable

(on macOS/linux):
On macOS/linux:

export GH_TOKEN="<YOUR_TOKEN_HERE>"

(on Windows, run in powershell):
On Windows, run in powershell:

[Environment]::SetEnvironmentVariable("GH_TOKEN","<YOUR_TOKEN_HERE>","User")

make sure to restart IDE/Terminal to inherit latest env variable.
Make sure to restart IDE/Terminal to inherit latest env variable.

5. Publish with the `publish.sh` script:
5. Publish for your platform with:

./publish.sh
In case of Windows, directly run the command: ```node_modules/.bin/build --win -p always```
build -p always

or

npm run publish

If you want to publish for more platforms, edit the `publish` script in `package.json`. For instance, to build for Windows and macOS:

...
"scripts": {
"publish": "build --mac --win -p always"
},
...

6. Release the release on GitHub by going to <https://github.com/iffy/electron-updater-example/releases>, editing the release and clicking "Publish release."
6. Release the release on GitHub by going to <https://github.com/iffy/electron-updater-example/releases>, editing the release and clicking "Publish release."

7. Download and install the app from <https://github.com/iffy/electron-updater-example/releases>.

Expand Down
43 changes: 23 additions & 20 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ autoUpdater.on('update-not-available', (info) => {
sendStatusToWindow('Update not available.');
})
autoUpdater.on('error', (err) => {
sendStatusToWindow('Error in auto-updater.');
sendStatusToWindow('Error in auto-updater. ' + err);
})
autoUpdater.on('download-progress', (progressObj) => {
let log_message = "Download speed: " + progressObj.bytesPerSecond;
Expand All @@ -86,7 +86,7 @@ autoUpdater.on('download-progress', (progressObj) => {
sendStatusToWindow(log_message);
})
autoUpdater.on('update-downloaded', (info) => {
sendStatusToWindow('Update downloaded; will install in 5 seconds');
sendStatusToWindow('Update downloaded');
});
app.on('ready', function() {
// Create the Menu
Expand All @@ -99,8 +99,22 @@ app.on('window-all-closed', () => {
app.quit();
});

//
// CHOOSE one of the following options for Auto updates
//

//-------------------------------------------------------------------
// Auto updates - Option 1 - Simplest version
//
// This will immediately download an update, then install when the
// app quits.
//-------------------------------------------------------------------
app.on('ready', function() {
autoUpdater.checkForUpdatesAndNotify();
});

//-------------------------------------------------------------------
// Auto updates
// Auto updates - Option 2 - More control
//
// For details about these events, see the Wiki:
// https://github.com/electron-userland/electron-builder/wiki/Auto-Update#events
Expand All @@ -110,6 +124,9 @@ app.on('window-all-closed', () => {
// Uncomment any of the below events to listen for them. Also,
// look in the previous section to see them being used.
//-------------------------------------------------------------------
// app.on('ready', function() {
// autoUpdater.checkForUpdates();
// });
// autoUpdater.on('checking-for-update', () => {
// })
// autoUpdater.on('update-available', (info) => {
Expand All @@ -120,20 +137,6 @@ app.on('window-all-closed', () => {
// })
// autoUpdater.on('download-progress', (progressObj) => {
// })
autoUpdater.on('update-downloaded', (info) => {
// Wait 5 seconds, then quit and install
// In your application, you don't need to wait 5 seconds.
// You could call autoUpdater.quitAndInstall(); immediately
setTimeout(function() {
autoUpdater.quitAndInstall();
}, 5000)
})

app.on('ready', function() {
autoUpdater.checkForUpdates();
});

// Update will be downloaded now but installed only on the next launch of the app
// app.on('ready', function() {
// autoUpdater.checkForUpdatesAndNotify()
// });
// autoUpdater.on('update-downloaded', (info) => {
// autoUpdater.quitAndInstall();
// })
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
{
"name": "electron-updater-example",
"version": "0.4.2",
"version": "0.5.0",
"main": "main.js",
"description": "electron-updater example project",
"author": "Matt Haggard",
"scripts": {
"publish": "build -p always"
},
"devDependencies": {
"electron": "^1.7.9",
"electron-builder": "^19.43.3"
Expand Down
10 changes: 0 additions & 10 deletions publish.sh

This file was deleted.

0 comments on commit 2d4aaee

Please sign in to comment.