Can you add binaries to releases with GitHub Actions?

I currently search for a way to automatically add generated binaries (in my case Jar files) to a release, which was already created, meaning it doesn’t create a release and adds files, but instead listens for when I create a release and attaches the files to it.

Is there a way to achieve this? I found some workflows, but they all don’t really explain what parts are important and how you could get files from different tasks (in my case a task in build.gradle that builds the jars and then uploads it to bintray)

1 Like

Something like this? https://github.com/actions/upload-release-asset

Yes, but from what I understand would this require the release to be created within the same workflow, while in my case I want to add the files/assets to the release I myself create.

Like already mentioned do I already have a setup to create the binaries to then upload them to an external site and are now wondering if I could use those generated files to attach them to the release I created.

Check out https://github.com/softprops/action-gh-release

I think you don’t get my point.

I want to add an asset to an already existing release (when I created it) and not create one from a push, which is what your answer and the answer before you suggest.

I already found a possible solution and look into it further.

@andre601 What did you come up with?  I was looking to do something similar; define a workflow that gets executed when a release is created, which would build/upload the dist binary to it.

I started to use AButler/upload-release-assets as it allows me to define multiple files to upload.

I set up a workflow, which creates the files, zips them, and then I upload both the zip and the generated files to the release which works perfectly fine.

You just need to make sure that the name of the file you create and the one you set in the workflow have the exact same spelling, or else it will be skipped without any errors nor messages.

1 Like

To close the loop on this, this is what I ended up with.

I learned that you can access the webhook payload within your action, so I simply listen for when a release was created, build the binary, and grab the upload_url as a way to upload it.  Quite simple and works perfectly for my use case.

3 Likes

Thank you very much, @blacksmoke16, this one must be accepted as a proper solution