-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building and Releasing using Channels #1182
Comments
Side note — s3 offers ssl, cloudfront not required. |
Thanks develar, yes actually the reason for cloudfront was Chrome giving a warning upon download (untrusted content) which went away using the domain the electron app is also signed with via cloudfront. |
Great and amazing idea. Will be implemented.
Thanks for clear feature request. |
semver works correctly — https://runkit.com/584689129842660013ba48de/58908629690e68001400de86 |
BREAKING CHANGE: if app version is `0.12.1-alpha.1`, file `alpha.yml` will be generated instead of `latest.yml` Close electron-userland#1182
BREAKING CHANGE: if app version is `0.12.1-alpha.1`, file `alpha.yml` will be generated instead of `latest.yml` Close electron-userland#1182
@develar thanks a lot for implementing this. Works great. One question if you allow:
This works fine but feels awkward so just to confirm - is there any better way possible currently? Thanks a bunch |
@consense @develar What is the best way of doing it according to this issue? |
@develar Problem solved: looks like Anyway I suggest to add proper documentation for it, its really unclear how to implement channels |
@develar what is the proper way to handle the scenario that is mentioned by @consense:
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: Is there any solution to handle this ? If yes what is it or what is the tricks ? Thanks |
@develar Thanks for reply, but I use a I think this would be done by doing one of this:
What do you think about implementing this or what is the workaround (with a |
@popod In case of generic server, you need to call setFeedUrl with modified value of No magic here. Updater simply uses channel to construct URL of update info file. No restrictions on version. If new downloaded update info reported that new version is If you want to allow downgrade, set The only problem here — get generic config URL. i.e. when do you call I will make configOnDisk public, but you can access it in any case. |
@popod Will be amazing if you will write an article to docs when you will implement it ;) |
@develar I think I've understand how the auto-updater works, but how does it know that a new "stable" version is available if it check the "beta" channel ? Example:
Here, there is no way to know that the v0.1.2 is available if the server check the "beta" channel.. If I'm right, this is not possible now with How could this be implemented ? And yes, I will be happy to write some docs about that when I will have the solution ;) |
@popod Ouch, you are right. |
@develar and what about this trick ? I take my latest example. The checked channel is "beta" and a new "stable" v0.1.2 is available. If I copy the If yes, I suggest to add an option What do you think about that ? |
I think it is ok to think about update info files as "feed". Solution on client side is not good because it will increase HTTP request count and it costs money. Also, we should keep AppUpdater code small and simple as much as possible, because this code bundled with user app and so, it should be easily reviewable to ensure security. I like you suggestion. I don't like |
I don't think so.. We need additional channel files following this :
|
How do you want to configure it? I mean — via config, via extraMetadata? |
@popod Please try 19.35.0 |
@develar a big thanks for this feature ! I will test it now ;)
Thanks !!! |
It is not strictly related. It is your own decision. If you user decided to change channel from beta to latest — yes, you need to set
Please file issue ;) Yes — if this method will be added, probably we can automatically set |
I think that with |
I can't get a head or tail out of it. |
Ok, this is really confusing.. how do I set up channels today? |
@jarrodek channels not supported for GitHub. Use prerelease instead. @thomastvedt -c.publish.channel should work, but only if publish is specified in your config as one item. |
I got -c.publish.channel to work after replacing my three seperate publish-sections for each platform with one publish section as you suggested :) This didn't work with -c.publish.channel (maybe it should?):
But this worked: "build": {
"appId": "com.domain.app",
"productName": "app",
"copyright": "Copyright © 2017 ${author}",
"artifactName": "${productName}-${channel}.${ext}",
"compression": "normal",
"detectUpdateChannel": "true",
"files": [
"build/**/*"
],
"extraMetadata": {
"main": "build/electron.js"
},
"publish": {
"provider": "s3"
},
"mac": {
"category": "public.app-category.business",
"target": "default",
"icon": "build/app-logo512.icns",
"type": "development"
}
} |
So this is definitely not helpful at all. I fail to make multi channel setup following this thread. What is more confusing is that official documentation points to this thread, like this thread should show clearly how to do it. What does -c.publish.channel do for you? Does your CI dynamically generate and replace content of your package.json? I have
This is my build config
I have tried to run:
when
This creates:
ci.yml points to app-latest.exe. When you run the app on update it goes to latest channel instead of ci channel. How should I properly proceed, I only want to run a command for build with multiple channels? |
@Johnz86 Yes, I agree with you. I will write some doc and submit a PR when I will have some time... Have you try to add |
@popod I pray for such docs :) You will be a hero :) I am too slow to implemented required for you functionality, but I hope now nothing stops you to help us :) |
@popod
I get following error:
|
@Johnz86 yes this is |
@popod you are right, after I fixed the typo, it was executed. Still the build was with the same result ci.yml and productName-latest.exe |
So I found out the reason. The channel name is taken from version information in package.json. If there is no suffix then the channel value will be latest. If there is a value for example "0.30.4-ci", then your ${channel} will be "ci". The problem is if you want to include version information in the artifactName. You will get for example from "${name}-${version}-${channel}.${ext}" => "app-0.30.4-ci-ci.exe". So to create a different channel I used:
I used command
and this produced:
and during the start of the app the auto-update correctly contacted ci.yml channel of the bucket. This is very cumbersome. The channel information in publish section during build is ignored. And channel information must be included in version. |
@Johnz86 I'm not sure that I understand what you finally want, but if you only want to create a "ci" channel, If channel is ignored with Hope this will help. |
@popod Anything else is required to be done before you can write docs about channels? |
@develar nothing for now.. I need to take some time to do that :) hope this will be soon. |
I came here looking for a simple way to construct a beta channel where beta versions such as 1.0.0-beta.4 (the 4th beta of version 1.0.0) can be promoted to version 1.0.0 (stable). Is this possible? |
@semireg just follow this tutorial: https://www.electron.build/tutorials/release-using-channels. You need to set |
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:
Build
new version is pushed with
app/package.json
containing a version such as0.12.1-alpha.1
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 ofAppName 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 correctpublish.channel
parameter itself without relying on a custom script for this?CI server uploads the yml and exe file to generic http host (e.g. using s3-deploy npm package)
So S3 contains eventually a growing number of distribution versions (exe) and 3 yml files (
alpha.yml
,beta.yml
andrelease.yml
)Auto-update
Electron app initializes autoupdater passing in the desired release channel at runtime. e.g.
autoUpdater.setFeedURL({url: 'https://mys3bucketurl.com', channel: 'alpha'});
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 inelectron-builder/packages/electron-updater/src/AppUpdater.ts
Line 156 in 7c2973d
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 version0.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?
Update is downloaded and event
update-downloaded
is being raisededit: removed reference to cloudfront as it wasnt contributing to the core question
The text was updated successfully, but these errors were encountered: