Skip to content

Commit 2d4aaee

Browse files
committed
Version 0.5.0
1 parent 652865c commit 2d4aaee

File tree

4 files changed

+46
-39
lines changed

4 files changed

+46
-39
lines changed

README.md

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,35 @@ If you can't use GitHub, you can use other providers:
3535

3636
npm install
3737

38-
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
38+
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
3939

40-
(on macOS/linux):
40+
On macOS/linux:
4141

4242
export GH_TOKEN="<YOUR_TOKEN_HERE>"
4343

44-
(on Windows, run in powershell):
44+
On Windows, run in powershell:
4545

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

48-
make sure to restart IDE/Terminal to inherit latest env variable.
48+
Make sure to restart IDE/Terminal to inherit latest env variable.
4949

50-
5. Publish with the `publish.sh` script:
50+
5. Publish for your platform with:
5151

52-
./publish.sh
53-
In case of Windows, directly run the command: ```node_modules/.bin/build --win -p always```
52+
build -p always
53+
54+
or
55+
56+
npm run publish
57+
58+
If you want to publish for more platforms, edit the `publish` script in `package.json`. For instance, to build for Windows and macOS:
59+
60+
...
61+
"scripts": {
62+
"publish": "build --mac --win -p always"
63+
},
64+
...
5465

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

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

main.js

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ autoUpdater.on('update-not-available', (info) => {
7777
sendStatusToWindow('Update not available.');
7878
})
7979
autoUpdater.on('error', (err) => {
80-
sendStatusToWindow('Error in auto-updater.');
80+
sendStatusToWindow('Error in auto-updater. ' + err);
8181
})
8282
autoUpdater.on('download-progress', (progressObj) => {
8383
let log_message = "Download speed: " + progressObj.bytesPerSecond;
@@ -86,7 +86,7 @@ autoUpdater.on('download-progress', (progressObj) => {
8686
sendStatusToWindow(log_message);
8787
})
8888
autoUpdater.on('update-downloaded', (info) => {
89-
sendStatusToWindow('Update downloaded; will install in 5 seconds');
89+
sendStatusToWindow('Update downloaded');
9090
});
9191
app.on('ready', function() {
9292
// Create the Menu
@@ -99,8 +99,22 @@ app.on('window-all-closed', () => {
9999
app.quit();
100100
});
101101

102+
//
103+
// CHOOSE one of the following options for Auto updates
104+
//
105+
106+
//-------------------------------------------------------------------
107+
// Auto updates - Option 1 - Simplest version
108+
//
109+
// This will immediately download an update, then install when the
110+
// app quits.
111+
//-------------------------------------------------------------------
112+
app.on('ready', function() {
113+
autoUpdater.checkForUpdatesAndNotify();
114+
});
115+
102116
//-------------------------------------------------------------------
103-
// Auto updates
117+
// Auto updates - Option 2 - More control
104118
//
105119
// For details about these events, see the Wiki:
106120
// https://github.com/electron-userland/electron-builder/wiki/Auto-Update#events
@@ -110,6 +124,9 @@ app.on('window-all-closed', () => {
110124
// Uncomment any of the below events to listen for them. Also,
111125
// look in the previous section to see them being used.
112126
//-------------------------------------------------------------------
127+
// app.on('ready', function() {
128+
// autoUpdater.checkForUpdates();
129+
// });
113130
// autoUpdater.on('checking-for-update', () => {
114131
// })
115132
// autoUpdater.on('update-available', (info) => {
@@ -120,20 +137,6 @@ app.on('window-all-closed', () => {
120137
// })
121138
// autoUpdater.on('download-progress', (progressObj) => {
122139
// })
123-
autoUpdater.on('update-downloaded', (info) => {
124-
// Wait 5 seconds, then quit and install
125-
// In your application, you don't need to wait 5 seconds.
126-
// You could call autoUpdater.quitAndInstall(); immediately
127-
setTimeout(function() {
128-
autoUpdater.quitAndInstall();
129-
}, 5000)
130-
})
131-
132-
app.on('ready', function() {
133-
autoUpdater.checkForUpdates();
134-
});
135-
136-
// Update will be downloaded now but installed only on the next launch of the app
137-
// app.on('ready', function() {
138-
// autoUpdater.checkForUpdatesAndNotify()
139-
// });
140+
// autoUpdater.on('update-downloaded', (info) => {
141+
// autoUpdater.quitAndInstall();
142+
// })

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
22
"name": "electron-updater-example",
3-
"version": "0.4.2",
3+
"version": "0.5.0",
44
"main": "main.js",
55
"description": "electron-updater example project",
66
"author": "Matt Haggard",
7+
"scripts": {
8+
"publish": "build -p always"
9+
},
710
"devDependencies": {
811
"electron": "^1.7.9",
912
"electron-builder": "^19.43.3"

publish.sh

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)