crate-ci / cargo-release

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

How to release a multi-member workspace with inter-crate dependencies? #775

Closed sebady closed 6 months ago

sebady commented 6 months ago

I'm trying to find some example of how to publish multi-member workspaces that have inter-crate dependencies with version = * path dependencies using the release plugin. The workspace looks something like this (somewhat simplified)

memberB has a dependency to A, like this [dependencies] crateA = { path = "../memberA" , version = "*", registry = "some registry" }

The workspace version is managed in the root Cargo.toml and is inherited by all members. The question I have is how to handle the version = * string in path dependencies. When attempting to do a dry run of a release I always encounter this error. error: all dependencies must have a version specified when publishing

There are no dependency cycle here. Is the only option here to invoke cargo release on each member crate in turn?

epage commented 6 months ago

I believe that error is coming from cargo or crates.io, not from cargo-release.

If you put in the version of the package in that field, cargo-release will automatically update it as you go. You can do cargo release patch --workspace and it will bump the workspace version, the dependency version requirements, etc and publish all packages with that single command.

e.g. a commit generated by cargo-release when releasing clap: https://github.com/clap-rs/clap/commit/5e4facf76fb38e04edba6cb1ab67d4f2b1ec8550

sebady commented 6 months ago

Thanks @epage. That helps seeing the example in clap.
I have one followup question. Is there a way to ignore the license | license-file requirement in package manifest during cargo release?

These are internal crates and not being published to crates.io. I tried adding --no-verify but that didn't seem to be sufficient.

epage commented 6 months ago

"Internal crates" as in not being published at all or being published to an alternative registry?

sebady commented 6 months ago

Crates being published to an alternative internal registry.

epage commented 6 months ago

For the rules that are crates.io specific, I would be fine with them being limited to only crates.io

epage commented 6 months ago

btw as the core of this issue is resolved, I'm going to go ahead and close it. Feel free to create another issue (or straight to PR) for the metadata validation