How to auto-build binaries on GitHub release?

I'm using GitHub Workflows to auto-validate recent commits with rustfmt and clippy, but I think maybe that's possible to create the binaries on release using their Ubuntu, MacOS and Windows images?

Thanks

This is what cargo-dist is for.

2 Likes

hm, thanks for the reference, seems I need some time to understand how does it work..

The brute force version is using a job matrix to run cargo build on each runner flavor, then using gh release to create a release and/or update it's assets. Looks like cargo-dist sets that all up for you though!

1 Like

You can install cargo, build, release, and then upload target(s) to release when a tag is pushed.

1 Like

I'm already uploading the binaries manually, but think this way incorrect and maybe unsafe for user. Because if there is no verified image provider, the maintainer able to upload anything else. I think that experienced maintainers using something like GH Workspace or crates above, never doing that manually.

For example, PHP Packagist listen repository Tags for updates, it maybe syncing with GH Actions, I expected just to see something similar to .github/workflows/build.yml but it looks harder for me than one additional meta file (or command)

I mean creating a GitHub workflow file that does the aforementioned work automatically. You can use existing tools to generate one, referring to other repositories that has auto release workflows, or creating one from scratch. If you're interested, you can refer to my workflow file, which publishes crate and builds and releases binaries on Linux, Windows and MacOS when a tag starting with v is pushed.

1 Like

Thank you, this example is maybe that I'm looking for!