Skip to content

Cargo package version from git tag #12144

@dariocurr

Description

@dariocurr

Problem

I find very useful to inject the package version from git tags, without have to specify it in a file.

When using python, I use setuptools-scm, that, as they say, extracts Python package versions from git or hg metadata instead of declaring them as the version argument or in a SCM managed file.

I believe this is very helpful and useful in CI/CD

Proposed Solution

To have a better understanding, let's make an example.
When I open a repo, I tag the branch to 0.0.1, then every commit I do, the version increases, showing the commits distance from the previous version, that is detected using the git tag. Then after 50 commits, I'll have version 0.0.1-dev50.

When a patch is ready, the branch is tagged as 0.0.2 and the counting restarts.

Notes

I'll love to contribute to achieve this feature, but I really don't have a clue where to start

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-infoStatus: Needs more info, such as a reproduction or more background for a feature request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions