actions-rs / meta

🦀 GitHub Actions for Rust - recipes, discussions, questions and ideas
https://github.com/actions-rs
Creative Commons Zero v1.0 Universal
353 stars 15 forks source link

Support a release action #6

Open cyplo opened 4 years ago

cyplo commented 4 years ago

Hi ! Thanks for all the actions :)

Would be amazing to have a release action that would 1) build and test everything 2) bump the version 3) tag in git 4) publish to crates.io but also to github releases

https://github.com/sunng87/cargo-release does most of the above

What do you think ?

svartalf commented 4 years ago

Some kind of "release" Action would be nice, but there are few questions that should be considered before.

For example, would second point mean that all sub-crates in a workplace will get the version bumped? Should such Action parse sources and bump versions in there too, like in the html_root_url attribute? On what event should Action be triggered if it should tag the sources also?

So far I could imagine auto-cargo publish on a new git tags, but the whole "make me a release" process creates too many questions :)

stepankuzmin commented 4 years ago

Hi! It would be great to have some kind of "simple" release action what can be run on:

on:
  release
    types: [published, created, edited]

That will publish to crates.io and to Github releases

svartalf commented 4 years ago

@stepankuzmin on: release trigger means that Github release were created already, I'm not following what should be published to the Github releases then?

As for crates.io release, it should be quite easy without any additional Action to do that, smth like this should do the job:

- steps:
  - uses: actions/checkout@v1
  - run: cargo login ${CRATES_IO_TOKEN}
    env:
      CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
  - run: cargo publish
stepankuzmin commented 4 years ago

Hey @svartalf, thanks for the reply! The idea was then user tags a commit — CI builds assets and publishes them on Github release page.

svartalf commented 4 years ago

@stepankuzmin yeah, that's actually is an open question for me: would it be possible to make an Action which will cover usual needs for a release process.

For example, what do you mean by "assets"? Is your crate is a binary crate and you want to attach the pre-built binaries to the GH release page? Or maybe your crate is generating .h files for an FFI via cbindgen?

I'm not against the "Release" Action, obviously, but at this point I do not understand what should it do exactly, so I would love to hear opinions and workflow descriptions from various projects first.

matchai commented 4 years ago

Is your crate is a binary crate and you want to attach the pre-built binaries to the GH release page?

Exactly this! Right now a difficulty is figuring out a way to build multiple targets with cross and succinctly releasing each of them in a single GitHub release, despite being separate jobs.

Azure Pipelines achieves this nicely with their GitHub Release task, which creates a release with the first artifact that is generated, and all parallel jobs eventually add their artifacts to that created release. It also auto-generates a release message containing a commit log, but automated changelogs using conventional commit messages would be extra nice!

stepankuzmin commented 4 years ago

I've spent some time and come with this solution based on softprops/action-gh-release. It's a bit ugly, but it works 🤷‍♂️

https://github.com/urbica/martin/blob/master/.github/workflows/ci.yml

thomaseizinger commented 4 years ago

I am working on some release automation at the moment for our Rust projects. As part of that, I wrote an action which allows you to set the version of a Cargo.toml manifest to a new one.

https://github.com/thomaseizinger/set-crate-version

YMMV but I've found small and focused GitHub actions more useful than larger ones. For example, this GitHub action doesn't make a commit for you but doing so is trivial via:

- name: Make a commit
  run: |
    git add Cargo.toml
    git commit --message "Bump versions for upcoming release"
pickfire commented 4 years ago

What about uploading binaries built to github for each release?

jmjoy commented 4 years ago

I think the method of rust-analyzer is worthy of reference, using the schedule for release.

brainstorm commented 4 years ago

https://github.com/awslabs/aws-lambda-rust-runtime/pull/235/files

samigiit commented 3 years ago

In my project there are multiple file I want to bump automatically in multiple file such as cargo.toml, cargo.lock, redme.md and so on. is there any way to do this.