electron-builder: Don't publish by default on github builds
- Version: 22.9.1
When setting up a new github actions build, it attempts to publish the result automatically to github by default. I only noticed this because I received an unexpected error at the end of my build:
⨯ GitHub Personal Access Token is not set, neither programmatically, nor using env "GH_TOKEN"
This was a normal branch build, not tagged or anything, which I’d never normally want to publish.
This behaviour is pretty surprising, and in many cases it’s a serious security risk if you don’t expect it when there’s github token in the environment for some other reason. Build output even in open source repos could easily contain secrets, especially when you’re first setting up a new build - it would be easy for this to accidentally publish your code signing keys, for example.
Also, this surprising behaviour isn’t documented - there’s no default value for publish listed on the config value or CLI arguments.
There’s been quite a few issues discussing this in the past, all now closed due to inactivity, e.g. https://github.com/electron-userland/electron-builder/issues/4546 and https://github.com/electron-userland/electron-builder/issues/1693. I think it’s pretty clear that this is causing confusion.
Are you be open to disabling this? I think it’s just a matter of making null the default value for publish config (that’s the current workaround for this behaviour). I’d be happy to put a PR together for this, if you’re open to that.
In general, I’d personally prefer to have electron-builder publish as a separate action, so I can build that into my CI workflow in more complex ways (e.g. testing a built distributable before it’s published) but that’s a separate question, and being able to opt-in with --publish is fine for now.
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 23
- Comments: 16 (5 by maintainers)
Commits related to this issue
- fix(ci): should not publish when running ci relative issue: https://github.com/electron-userland/electron-builder/issues/5463 — committed to guyutongxue/devcpp7 by guyutongxue 6 years ago
honestly shocked to see that this is nearly 4 years old and counting. i started a project that uses electron-builder recently, and have only now gotten around to setting up a workflow to automatically make snapshot builds of my app. what i was not expecting at all was the build to immediately fail because it didn’t have a github token… huh??? why the hell does it need that???
oh, because it wants to create a release build… so glad that there was plenty of forewarning and documentation on this feature and that i didn’t have to search far and wide for an entire hour until i uncovered this nearly 4 year old github issue. 😬
This is still relevant, it has a fair few votes now, and AFAIK there’s nothing blocking it and it’s very easy to do (although it is a breaking change!). It would be great to hear thoughts from the maintainers on this issue.
Personally, I really do think it shouldn’t autopublish at all, it’s very unexpected. It’s quite surprising and it’s an easy way to accidentally leak secrets etc.
Reducing the warning wouldn’t really help - if anything, it makes it more likely that you’ll leave this on accidentally.
Yep, definitely agree it’s a breaking change.
Could it be disabled by default as a breaking change for v26? If that works for you, v25 could start showing a warning message now for all automatic GitHub publishes (for any publishing that wasn’t explicitly requested with a CLI argument) with something like:
That doesn’t break anything, if it annoys anybody now then they can remove the warning by using
--publishexplicitly, and it’ll be relatively safe in v26 to disable publishing by default completely.I was also surprised by this behavior. (fixed by adding --publish=never)