axodotdev / axodotdev/cargo-dist
Add a pr-run-mode that can handle projects with different versions
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 149
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 32
Description
Feature request: make it so the release workflow for a PR can cope with a workspace that has projects that have different version numbers. Something like `pr-run-mode="plan-by-project"`.
Rather than reporting “too many unrelated apps in your workspace to coherently Announce,” run `cargo dist plan` with the tag and version of each project.
Example: here is a PR where we were trying to update the version of one project in a workspace:
- https://github.com/dfinity/dfx-extensions/pull/100 (see [first commit](https://github.com/dfinity/dfx-extensions/pull/100/commits/63548c17a77aca1bb56fef0c59748ac188a483b3))
Since we were using the default `pr-run-mode="plan"`, we got this error:
> × There are too many unrelated apps in your workspace to coherently Announce!
> help: Please either specify --tag, or give them all the same version
>
> Here are some options:
>
> --tag=v0.3.1 will Announce: nns
> --tag=v0.4.0 will Announce: sns
>
> you can also request any single package with --tag=nns-v0.3.1
It's a PR, so we can't specify a tag, but from the error message we can see that `cargo dist plan` already knows which tags we _should_ specify for every project.
We ended up having to update the versions of both projects. This was fine; we were going to update both anyway; but it won't always be the case that project versions are in lockstep.
I would like for the release.yml workflow in this case to effectively run `cargo dist plan --tag=-v` for every project in the workspace, which in this example would be:
```
cargo dist plan --tag=nns-v0.3.1
cargo dist plan --tag=sns-v0.4.0
```
In other words: I’m opening a PR to update the version of one project in a workspace. I’m going to follow it up with `cargo dist plan --tag=-v && cargo release -p `. I'd like the release workflow to do what it can to verify that this will work, even if that means running `cargo dist plan` for every project.
As far as I can see, the only workaround is to set `pr-run-mode="skip"`.
Contributor guide
Research direction
Start with the release.yml workflow and its existing pr-run-mode="plan" handling. Read the cargo dist plan behavior described in the issue, including the project-specific tags shown in the error, and compare it with cargo release -p usage. Done means the workflow can validate each project in a mixed-version workspace without requiring all versions to match.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, rust
- Domain
- ci-cd, release
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100