MarcoIeni / release-plz

Publish Rust crates from CI with a Release PR.
https://release-plz.ieni.dev
Apache License 2.0
826 stars 83 forks source link

Allow running `set-version` in GitHub actions #1559

Open MarcoIeni opened 3 months ago

MarcoIeni commented 3 months ago

Motivations

It would be nice to quickly run release-plz set-version without the need to git checkout the PR locally.

Solution

Release-plz checks the PR comments and reacts to comments respecting the regex release-plz set-version <set-version-args>. If one comment is detected, it runs it from gh actions.

Note:

Additional context

MarcoIeni commented 3 weeks ago

This issue is taken by an external contributor 🎉 They will raise PRs or write in GitHub soon.

LNSD commented 3 weeks ago

I am working on a GH workflow file for rapid prototyping of this functionality. Once the Proof-of-concept is working, I will integrate this into Rust.

So far, I managed to:

I got stuck with the last part: committing the changes and updating the release PR. I suspect this last part should be performed using the release-plz release-pr command. Thus, a signed commit is created using the GitHub API and then pushed to the PR, updating the title and description.

Here you can find the POC workflow file (WIP): https://github.com/LNSD/release-plz-fixtures/blob/08ac25c5373708291b2a8519d7de556eab606c26/.github/workflows/release-cmd.yml

MarcoIeni commented 3 weeks ago

I think for the last part (where you got stuck), it's easier to do it in rust because you could reuse parts of the code of release-pr command. 👍

MarcoIeni commented 3 weeks ago

Here's some docs on how to commit and push to the release pr: https://release-plz.ieni.dev/docs/github/output#example-commit-files-to-the-release-pr

LNSD commented 3 weeks ago

For the record. This is a common use case that I am trying to cover with this release PR workflow command:

  1. I do my normal development in my project and push an internal logic-breaking change.
  2. The release-plz action kicks in and creates the release PR (using the release-pr command). However, as the change is not in the public-facing API, the version gets a minor/patch version bump (e.g., v0.2.1 instead of v0.3.0)
  3. I want to override the PR's version with a major version bump, so I comment with /release-plz set-version <package>@<new-version>.
  4. The comment-triggered workflow, first, should bump the package version, the set-version subcommand, and update the different project files.
  5. The comment-triggered workflow, next, should commit the changes and force push them to the release PR. NB: The commit should be signed.
  6. The command-triggered workflow, finally, should update the release PR title and description (e.g., text, links, etc.) accordingly.