question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Q: unable to create release version from tag

See original GitHub issue

I have a version.json file that looks like this:

{
  "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
  "version": "0.9",
  "versionHeightOffset": 2,
  "publicReleaseRefSpec": [
    "^refs/tags/rel/\\d+\\.\\d+\\.\\d+"
  ]
}

When I try to build from a tag named rel/0.9.2 I expect the nuget package to be versioned 0.9.2, but it is versioned 0.9.9-g3ed3d4226b.

To reproduce:

git clone https://github.com/tmds/Tmds.DBus.git
cd Tmds.DBus/
git checkout bump_092
git tag rel/0.9.2
git checkout rel/0.9.2
dotnet pack -c Release src/Tmds.DBus

It’s not clear what I’m doing wrong, or maybe I misunderstand some fields in version.json?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:24 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
KalleOlaviNiemitalocommented, Jan 26, 2022

FYI, I tried a few formats with Nerdbank.GitVersioning v3.4.255 and no “publicReleaseRefSpec”:

“version” in version.json AssemblyFileVersion AssemblyInformationalVersion NuGetPackageVersion
“1.51.0-dev.{height}” “1.51.0.0” “1.51.0-dev.21+3db68092be” “1.51.0-dev-0021-g3db68092be”
“1.51.0.{height}” Error “not a valid semantic version”
“1.51.0-{height}” “1.51.0” “1.51.0-21+0018fc9f88” “1.51.0-0021-g0018fc9f88”
“1.51.0” “1.51.0.22” “1.51.0+58d40d701e” “1.51.0-g58d40d701e”
“1.51” “1.51.21.16034” (16034 is 0x3ea2 from the commit ID) “1.51.21+a23e463e6a” “1.51.21-ga23e463e6a”
“1.51.{height}” Error “not a valid semantic version”
“1.51-{height}” “1.51” “1.51.0-21+82ed498be5” “1.51.0-0021-g82ed498be5”
“1.51-beta.{height}” “1.51” “1.51.0-beta.21+b14392952a” “1.51.0-beta-0021-gb14392952a”

So, it seems impossible to get the version height in both AssemblyFileVersion and AssemblyInformationalVersion while explicitly specifying three components of the version. I did not try "nugetPackageVersion": { "semVer": 2 }.

2reactions
tmdscommented, Jan 25, 2022

versionHeightOffset can be used to deal with the first, though it would be easier to be able to set the exact number, instead of having to calculate the offset.

Thinking about it more: it would be interesting to have the version height as the 4th version digit in this case.

This can work without an additional field when the user specifies a 3-number version.

{
  "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
  "version": "0.9.2"
}

Maybe some part of .NET tooling would have issues with the 4-number version?

Read more comments on GitHub >

github_iconTop Results From Across the Web

github error on create release: tag could not be ...
2 Answers 2 · I just tried tag name v1.2.0 with the same result. Does it matter how the files were tagged before...
Read more >
Creating new version failed: Git tag not found · Issue #218 · ...
Try deleting the tag, force push away the release commit, and try again. The GitHub issues yesterday caused similar problems for me.
Read more >
Unable to create release trigger based on Github tag
I want to create a release only when i create a release in github (it gets tagged with release . I tried to...
Read more >
How to Manage Releases with Semantic Versioning and Git ...
Being able to easily manage and communicate changes in code ... how to use Git tags to easily tag a repository with a...
Read more >
How to update a Github release? - Deployment
(this is a followup to my previous post) I would like my untagged commit builds to deploy to a GitHib release named like...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found