Skip to content

fix: --version now reports git tag instead of hardcoded 0.1.0#220

Merged
joaoantoniocardoso merged 3 commits into
bluerobotics:masterfrom
rafael-graunke:fix/version-shows-git-tag
Jun 18, 2026
Merged

fix: --version now reports git tag instead of hardcoded 0.1.0#220
joaoantoniocardoso merged 3 commits into
bluerobotics:masterfrom
rafael-graunke:fix/version-shows-git-tag

Conversation

@rafael-graunke

Copy link
Copy Markdown
Contributor

Closes #208

Root cause

--version was reading CARGO_PKG_VERSION, which is hardcoded to 0.1.0 in Cargo.toml and never updated on releases.

Fix

Switch to VERGEN_GIT_DESCRIBE, which is already generated by vergen-gix during the build and reflects the actual git tag.

Two additional issues had to be addressed to make this work:

  1. GixBuilder::all_git() calls .describe(false, false, None) internally, where the first argument means "annotated tags only". This repo uses lightweight tags, so git describe found nothing and emitted an empty string. Fixed by calling .all().describe(true, false, None) to include all tags.
  2. actions/checkout@v4 defaults to a shallow clone with no tags. Added fetch-tags: true to both checkout steps so tags are visible during CI builds.

Result

On a tagged commit: mavlink-server 0.8.0
Between releases: mavlink-server 0.8.0-16-gbfc96df

@joaoantoniocardoso joaoantoniocardoso self-requested a review June 18, 2026 19:30

@joaoantoniocardoso joaoantoniocardoso left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, welcome!

The changes are good; Before merging, I'll ask you to change the commits to follow the repository pattern.

Your single commit touches 3 different parts of the code, so make it three commits. Here's an example:

ci: Fetch git tags in checkout action

<short reasoning why this is needed>

Then, the other two would be something like build: <short description> and src: lib: cli: <short description>. Feel free to add more context in the commit bodies, similar to what you did in the PR body.

Thanks for the contribution!

Without fetch-tags: true, git checkout only fetches commits, not tags.
vergen relies on git describe to produce the version string, which needs tags reachable from HEAD.

@joaoantoniocardoso joaoantoniocardoso left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@joaoantoniocardoso joaoantoniocardoso merged commit 0825f15 into bluerobotics:master Jun 18, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--version returns wrong version number

2 participants