taiki-e / upload-rust-binary-action

GitHub Action for building and uploading Rust binary to GitHub Releases.
Apache License 2.0
242 stars 20 forks source link

How to upload to gitHub artifact #85

Open ahaoboy opened 1 week ago

ahaoboy commented 1 week ago

I want to publish the artifact to gitHub for each pr or commit so that it can be downloaded for testing, and publish the tag to github release. Is there any solution to achieve this? It is necessary to ensure that the release and artifact use the same compilation steps, so it would be useful to add a parameter artifact: true

taiki-e commented 1 week ago

Do you mean you want to do something like this?

(Now that outputs have been implemented, getting the filename is easier than when that code was written.)

ahaoboy commented 1 week ago

It's easier to add a field than using some magic bash script, and this script doesn't work on Windows. upload-rust-binary-action seems to have to read the tag information, so it can't be executed on every commit

https://github.com/ahaoboy/ansi2/actions/runs/11343461783

taiki-e commented 1 week ago

this script doesn't work on Windows

Try shell: bash or setting shell globally.

upload-rust-binary-action seems to have to read the tag information, so it can't be executed on every commit

It also works for events other than tags and releases by specifying the ref option as described here.

If you do not need to upload files for a release, you can use the dry-run option like this.

(The workflow I linked above is the one I actually use on projects like cargo-llvm-cov to make sure the build and archive steps of the release workflow works correctly at PR/push/scheduled job: https://github.com/taiki-e/cargo-llvm-cov/actions/runs/11338153284/job/31531038154)

ahaoboy commented 1 week ago

Thanks for your help, it's a bit tedious but at least it works. It would be nice if it could be built-in.