Managing development versions of a crate in an private registry

In my company we want to be able to publish and use crates internally on a private registry similarly to what we do with our conan packages for C.

In our conan setup we have two repositories, one for released packages, the other for development packages.
Our CI pushes a new package for every runs with a specific version depending on the branch:

  • the main branch uses X.Y.Z
  • feature branches use X.Y.Z-7digitsofcommithash.
    where X.Y.Z is the expected next version to be published.

Released package are packages taken from the main and copied to the released repository.

These versions allow packages from feature branches not to overwrite the current package from the main, and other can use and test our development packages before they are merge to main.

Setting a version for a conan package in a CI script is easy because conan allows to read the version of a package either from the command line or an environment variable.

With cargo we would need to edit the package version in Cargo.toml and uses --allow-dirty in our feature branches when publishing to the development registry.

I would prefer not to use --allow-dirty because it may hide other problems (artifacts generated outside of target for instance).

  • Is there another way to set the version before publishing a package?
  • Or is there a better way to manage development versions?

As of right now, I don't think so. There's an issue on GitHub that discusses this as a possible feature with people proposing various workarounds you might want to check out/present your use-case in to make the Cargo devs aware of it:

Thanks, that was the kind of discussion I was searching for but did not found on my own.

Apparently there is no perfect solution yet.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.