I need to support a special release per user (or group), and I want each user will auto-update to a new available release only if it's suitable for him (by some kind of logic in the backend).
I've tried to do so by using electron-builder's electron-updater module, and also by using Electron's autoUpdater built in module, but it seems that both always fetch the latest version when calling autoUpdater.checkForUpdates
.
I've seen that when deploying my own update server, some of them (such as nuts) support a download url for a specific version. as described using nuts
Specific version for detected platform: http://download.myapp.com/download/1.1.0
but there seem to be no support to request a specific version in the app itself using autoUpdater.
summarizing all this up: How can I achieve auto-update to a specific release other than latest?
The solution for me was channels.
appUpdater.channel
(getter and setter)Define the channel which the Auto-Updater will follow (see the auto-update with channels tutorial) using
appUpdater.channel = 'beta'
or get the current channel withcurrentChannel = appUpdater.channel
.
Note that channels are not supported when using GitHub as a provider (for now), as described in electron-builder autoUpdate documentation:
channel
String - Get the update channel. Not applicable for GitHub. Doesn’t return channel from the update configuration, only if was previously set.
You can set the channel name to anything, and can even dynamically (if needed) direct your users to pull updates from that channel.
You can also edit the {your-channel-name}.latest
file manually and add parameters that will help you determine whether the current "asking for update" user should consume the certain version (in the update-available
event from the updateInfo
parameter for example).