crate-ci / cargo-release

Cargo subcommand `release`: everything about releasing a rust crate.
Apache License 2.0
1.33k stars 112 forks source link

"Failed to parse manifest ... missing field `name` in `package`" with workspace #703

Closed 9999years closed 1 year ago

9999years commented 1 year ago

With this Cargo workspace Cargo.toml:

[workspace]
members = [
    "ghcid-ng",
    "test-harness",
    "test-harness-macro",
]
resolver = "2"

[package.metadata.release]
pre-release-commit-message = "Release {{crate_name}} version {{version}}"

Running cargo release patch gives me the following error:

$ cargo release patch
error: `cargo metadata` exited with an error: error: failed to parse manifest at `/Users/wiggles/ghcid-ng/Cargo.toml`

Caused by:
  missing field `name`
  in `package`

The docs suggest that at least some configuration is allowed in the workspace Cargo.toml, and if I remove the offending clause and run cargo release config, which the cargo release help describes as "Dump workspace configuration", the pre-release-commit-message field is shown in the output, suggesting I should be able to have it in my workspace Cargo.toml.

Anyways, the intended usage is a bit unclear here. I can work around this by putting my settings in the relevant crate Cargo.tomls (my workspace only has one crate I actually want to release), but I'm not sure if I'm holding the tool wrong or what.

Thanks for any help!

epage commented 1 year ago

Try replacing package.metadata.release with workspace.metadata.release

9999years commented 1 year ago

Thanks, that fixed it! Sorry I didn't catch that typo.