cargo-release
cargo-release copied to clipboard
Unclear that allow-branch is workspace-only config
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.
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.
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.
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