Closed timdp closed 4 years ago
I've done some more investigation myself and I think I've identified the issue.
In my Action's log, I can check whether publishing is supposed to happen based on this log line that I'd missed before:
Building the Electron app…
or
Building and releasing the Electron app…
The logging happens here and tells me that something is going wrong when release
is false
.
Hence, my analysis above about github.ref
was incorrect and the issue is in how the Action processes release = false
.
Now, contrary to your Mini Diary project, I have build.publish.github
in my package.json
:
{
"publish": [
{
"provider": "github",
"releaseType": "release",
"publishAutoUpdate": false
}
]
}
My assumption was that this would only get used when actually publishing, but I'm now thinking that it's being interpreted as "always publish to GitHub".
However, the counterpart to the Action's --publish always
is documented as --publish never
. I think passing this flag will override my package.json
config.
So I tried forking and publishing your Action to add --publish never
but strangely, it didn't have any effect: it still insisted on publishing in all cases. I guess this is starting to sound more like an issue with electron-builder
?
After many, many red herrings, I've identified a non-obvious electron-builder
feature as the culprit: on CI, it always publishes.
However, --publish=never
does disable that behavior. I'm not sure why my previous test didn't work.
At any rate, here's a workaround that doesn't involve updating the Action:
steps:
- name: Set electron-builder args
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
run: echo '::set-env name=EB_ARGS::--publish=never'
- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
github_token: ${{ secrets.github_token }}
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
args: ${{ env.EB_ARGS }}
Closing this issue since a) it belongs with electron-builder
and b) it's been resolved. Sorry for the noise.
The readme suggests that in order to only build version tags, I should use:
However, I don't think this is correct. When I push a tag, my GitHub Action runs for both the commit to
master
and the tag that points to it, which expected. However, in both cases, a release occurs:v0.1.9
tag:commit on
master
branch (different build with identical code):I believe
github.ref
is set to the tag on which the commit is based, rather than only being equal torefs/tags/v...
for the run for the actual tag.To make matters worse, the ref also appears to be set even if the branch is ahead of the tag. I updated my build config to change the output filename, pushed that change, and it added the resulting files (with the new filename) to the last release!
I hope I'm doing something wrong but since I just copied the
release
config verbatim, I'm not sure where to look.Unfortunately, this is for a private repo, but it should be easy to reproduce.