samuelmeuli / action-electron-builder

:electron: GitHub Action for building and releasing Electron apps
MIT License
658 stars 201 forks source link

Option to configure build script name #12

Closed leclercb closed 4 years ago

leclercb commented 4 years ago

Thanks for the action script ! It would be nice to be able to configure the build script name.

For the moment, this is how my scripts are looking, it's pretty hard to get the git hash via a command that works on every system. So I created two build scripts:

"build": "REACT_APP_GIT_COMMIT_HASH=$(git rev-parse --short HEAD) craco build", "build:github": "craco build",

And in the build and release steps of my workflow I added:

env: REACT_APP_GIT_COMMIT_HASH: "${{ github.sha }}"

PS: The script is working fine, but no artifact is generated once the build is complete, is it normal ?

Thanks

samuelmeuli commented 4 years ago

Yes, let's introduce an option for this (maybe called build_script or build_script_name). @leclercb Would you be interested in opening a PR?

Regarding the missing artifacts, have you set the release option? By default, no release is created.

leclercb commented 4 years ago

PR created.

To be honest, I didn't try the release yet as I still need to test the certificates option. What I mean, is that GitHub Actions is able to produce artifacts, that you can download when looking at the process. Adding an extra step in my yaml workflow to publish the artifact could do the trick. I don't know if it's feasible, but if this could be automatically called by the "action-electron-builder" it would be even better.

Because for the moment, if you don't release, you can see that the build was successful, but there is no way to download the generated binaries.

I hope it was clearer.

samuelmeuli commented 4 years ago

Now I understand. You're right, this isn't currently implemented. Could adding a https://github.com/actions/upload-artifact step after the Electron Builder Action work? If it's really that simple, I don't think this should be included in the action, but added to the README or a docs page.

leclercb commented 4 years ago

Actually, it's not that simple, because you need to know the name of the files generated, depending on the OS, multiple artifacts can be built and currently the upload-artifact action doesn't allow regex or patterns for multiple files. That's why, if "action-electron-builder" could call them, knowing the right name of every file created and then upload them, it would be much easier.

And btw, I think almost everybody would want to be able to download the generated binaries using this action instead of only knowing if it's successful or not.

samuelmeuli commented 4 years ago

I agree on the file renaming. But I don't know if uploading artifacts from within an action is already possible; I'm not sure if the API is already publicly available (see https://github.com/actions/upload-artifact/issues/7#issuecomment-566114993 and https://developer.github.com/v3/actions/artifacts).

samuelmeuli commented 4 years ago

This is tracked by #14