Skip to content

Inherited version.json changed unexpectedly by 'nbgv prepare-release #1280

@mfaulcon

Description

@mfaulcon

I am currently experimenting with Nerdbank.GitVersioning for use in a monorepo for which we want to follow the GitHub Flow branching strategy. As part of the testing, I have a version.json at the root level of the repository, as follows:

{
  "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
  "nugetPackageVersion": {
     "semVer": 2
  },
  "publicReleaseRefSpec": [
    "^refs/heads/master$",
    "^refs/tags/v\\d+(?:\\.\\d+)?$"
  ],
  "cloudBuild": {
    "setVersionVariables": true,
    "buildNumber": {
      "enabled": true
    }
  }
}

For one of the components in the monorepo (located in a folder below the root), I have another version.json:

{
  "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
  "inherit": true,
  "version": "1.3.0-alpha",
  "pathFilters": ["."],
  "release" : {
    "tagName" : "telemetry-v{version}",
    "branchName" : "telemetry-v{version}",
    "versionIncrement" : "minor",
    "firstUnstableTag" : "alpha"
  }
}

When I ran the command nbgv prepare-release --project . --format json, the component's version.json file was updated as below:

{
  "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/main/src/NerdBank.GitVersioning/version.schema.json",
  "version": "1.3.0",
  "nuGetPackageVersion": {
    "semVer": 2.0
  },
  "publicReleaseRefSpec": [
    "^refs/heads/master$",
    "^refs/tags/v\\d+(?:\\.\\d+)?$"
  ],
  "cloudBuild": {
    "buildNumber": {
      "enabled": true
    }
  },
  "release": {
    "tagName": "telemetry-v{version}",
    "branchName": "telemetry-v{version}"
  },
  "pathFilters": [
    "./"
  ]
}

I was expecting the change to the version, but the change of structure, and the fact that it no longer inherits from the root version.json file was a surprise. Is this expected behavior? If so, how would the inherit flag make any sense to use?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions