question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Building and Releasing using Channels

See original GitHub issue
  • Version: 11.2.4
  • Building on: win64

  • Target: win32/64

  • Aim: Allow users to receive alpha, beta or release builds via autoupdate. The type of channel would be set at runtime (depending on user-settings returned from a remote REST api). Generic server-side provider prefered. User set to channel alpha would receive alpha, beta and release updates, beta users beta and release, release users only release.

  • Problem: The process to accomplish the above may already be possible, but some information is spread across different ticket comments and at least for me not comprehensively understandable. In particular I am unsure whether my understanding describes the recommended workflow of electron-builder, seeing the project is (loving it) going through a lot of iterations in the last months. If you allow me to summarize my understanding of the necessary steps and accompanying questions:

  1. Build

    1. new version is pushed with app/package.json containing a version such as 0.12.1-alpha.1

    2. CI server could (in some external script) parse the version (e.g. 0.12.1-alpha.1) from app/package.json and execute the electron-builder build cli with channel-injecting parameter --em.build.publish.channel=alpha . This would result in alpha.yml file being created alongside of AppName 0.12.1-alpha.1.exe on the CI server. Question: Is electron-builder itself capable of recognizing from app/package.json that the version contains an alpha/beta prerelease tag and determine the correct publish.channel parameter itself without relying on a custom script for this?

    3. CI server uploads the yml and exe file to generic http host (e.g. using s3-deploy npm package)

    4. So S3 contains eventually a growing number of distribution versions (exe) and 3 yml files (alpha.yml, beta.yml and release.yml)

  2. Auto-update

    1. Electron app initializes autoupdater passing in the desired release channel at runtime. e.g. autoUpdater.setFeedURL({url: 'https://mys3bucketurl.com', channel: 'alpha'});

    2. Autoupdater fetches the yml corresponding to channel property passed into setFeedUrl from the generic http server. Autoupdater then checks, whether the version from the downloaded yml file is greater than the installed version (using semver.gt as in https://github.com/electron-userland/electron-builder/blob/7c2973dda46434827fc43a1c330bbf9da3923053/packages/electron-updater/src/AppUpdater.ts#L156) Question: semver.gt prevents prerelease upgrades e.g. from 0.12.1-alpha.1 to 0.12.3-beta.1 (see https://github.com/npm/node-semver#prerelease-tags ). While the reasoning from semver guidelines regarding handling of prerelease tags makes sense for NPM, in this case autoupdater has no way of knowing that version 0.12.2 (which would be a valid update) exists. Also semver.gt will never allow jumping from a release version (e.g. 0.12.2) to a prerelease version (e.g. 0.12.3-alpha.1) which makes the whole channel concept pointless. Is this already solved or am I maybe making stuff more complicated than it needs to be? Or would I need to write a lambda function myself which performs this kind of semver.satisfies check and streams the exe file through from s3?

    3. Update is downloaded and event update-downloaded is being raised

edit: removed reference to cloudfront as it wasnt contributing to the core question

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:11
  • Comments:48 (35 by maintainers)

github_iconTop GitHub Comments

9reactions
develarcommented, Jan 27, 2017

Is electron-builder itself capable of recognizing from app/package.json that the version contains an alpha/beta prerelease tag

Great and amazing idea. Will be implemented.

  1. Implement auto channel suggestion.
  2. Check semver logic, reported points are valid.

Thanks for clear feature request.

3reactions
popodcommented, Aug 24, 2017

@develar what is the proper way to handle the scenario that is mentioned by @consense:

someone who is on alpha channel should also get beta and release(=latest) updated.

I want to allow my users to get “prerelease” marked as “beta”. The channel (beta|latest) is defined in the application settings. I want thant the user who define “beta” channel get latest version too…

Example: List of my releases: v0.1.0, v0.1.1, v0.1.2-beta.1, v0.1.2-beta.2, v0.1.2, … The user with channel “latest” should only get v0.1.0, v0.1.1 and v0.1.2 the user with the channel “beta” should get all this updates.

Is there any solution to handle this ? If yes what is it or what is the tricks ? Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Release Using Channels - electron-builder
Channels are useful to distribute “beta” or “alpha” releases of your application to a chosen set of users. This allows to test an...
Read more >
Release channels - Expo Documentation
Use release channels in Expo to send out different versions of your application to your users by giving them a URL or configuring...
Read more >
Release Channels - React
Each of React's release channels is designed for a distinct use case: Latest is for stable, semver React releases. It's what you get...
Read more >
Channels - Octopus Deploy
Channels allow you to dynamically change the deployment logic and lifecycle of a project based on the version being deployed.
Read more >
Using channels to support releases - YouTube
Channels are designed to support the software release process.https://snapcraft.io/docs/ build -snaps/publishFind out more at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found