cargo-release icon indicating copy to clipboard operation
cargo-release copied to clipboard

Unclear that allow-branch is workspace-only config

Open imp opened this issue 3 years ago • 3 comments
trafficstars

I have following in Cargo.toml

[package.metadata.release]
allow-branch = ["main"]
pre-release-commit-message = "Bump version to {{version}}"
tag-message = "{{version}}"
tag-name = "{{version}}"
...

and cargo release happily works from other branches. Other things listed there, like tag-message, tag-name etc seem to do take effect as expected. The same configuration in release.toml instead of Cargo.toml works correctly.

imp avatar Feb 22 '22 09:02 imp

At the moment, we only support allow-branch at the workspace level, rather than at the package level. It should work for specify it in [workspace.metadata.release].

We should fix our documentation to clarify this.

If there is a use case for a package-specific allowed branch, we can also support that.

epage avatar Feb 22 '22 15:02 epage

Thanks for clarifying - indeed it was not clear that allow-branch is workspace only option. As for the use case - it is very simple - single-crate git repository. Since it is not a workspace I keep all my configuration in Cargo.toml under [package.metadata.release] and it used to work, so why not allow-branch? So it is not to override otherwise workspace-wide setting for a specific package, but to handle case where there is an only package/crate and no workspace at all.

imp avatar Feb 23 '22 11:02 imp

Its a trade off we're going to have to look at

  • Complexity of specializing for an individual crate
  • Any user confusion when scaling up to a workspace
  • Existing user confusion of needing to configure a workspace setting when workspaces aren't used

epage avatar Feb 23 '22 13:02 epage