Skip to content

Commit 1da8e82

Browse files
committed
Align VersionVariablesJsonModel to git version variables
Fix cache tests Update documentation
1 parent 7e9fdae commit 1da8e82

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

docs/input/docs/reference/configuration.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,13 @@ details on the syntax. Default set to `Enabled`; set to `Disabled` to disable.
591591

592592
Sets the format which will be used to format the `CommitDate` output variable.
593593

594+
### custom-version-format
595+
596+
Specifies the format of `CustomVersion`, allowing for a user-specific output variable
597+
that can be used, for example, as the NuGet package vesion.
598+
Default set to `{SemVer}`.
599+
Follows the same formatting semantics as `assembly-file-versioning-format`.
600+
594601
### ignore
595602

596603
The header property for the `ignore` configuration.

src/GitVersion.Core.Tests/Core/GitVersionExecutorTests.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public void CacheFileExistsOnDisk()
117117
"AssemblySemVer": "4.10.3.0",
118118
"AssemblySemFileVer": "4.10.3.0",
119119
"FullSemVer": "4.10.3-test.19",
120+
"CustomVersion": "4.10.3.0",
120121
"InformationalVersion": "4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f",
121122
"BranchName": "feature/test",
122123
"EscapedBranchName": "feature-test",
@@ -180,6 +181,7 @@ public void CacheFileExistsOnDiskWhenOverrideConfigIsSpecifiedVersionShouldBeDyn
180181
"AssemblySemVer": "4.10.3.0",
181182
"AssemblySemFileVer": "4.10.3.0",
182183
"FullSemVer": "4.10.3-test.19",
184+
"CustomVersion": "4.10.3.0",
183185
"InformationalVersion": "4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f",
184186
"BranchName": "feature/test",
185187
"EscapedBranchName": "feature-test",
@@ -271,6 +273,7 @@ public void ConfigChangeInvalidatesCache(string configFileName)
271273
"AssemblySemVer": "4.10.3.0",
272274
"AssemblySemFileVer": "4.10.3.0",
273275
"FullSemVer": "4.10.3-test.19",
276+
"CustomVersion": "4.10.3.0",
274277
"InformationalVersion": "4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f",
275278
"BranchName": "feature/test",
276279
"EscapedBranchName": "feature-test",
@@ -333,6 +336,7 @@ public void NoCacheBypassesCache()
333336
"AssemblySemVer": "4.10.3.0",
334337
"AssemblySemFileVer": "4.10.3.0",
335338
"FullSemVer": "4.10.3-test.19",
339+
"CustomVersion": "4.10.3.0",
336340
"InformationalVersion": "4.10.3-test.19+Branch.feature/test.Sha.dd2a29aff0c948e1bdf3dabbe13e1576e70d5f9f",
337341
"BranchName": "feature/test",
338342
"EscapedBranchName": "feature-test",

src/GitVersion.Output/Serializer/VersionVariablesJsonModel.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ internal class VersionVariablesJsonModel
3434
[JsonPropertyDescription("Suitable for .NET AssemblyInformationalVersion. Defaults to FullSemVer suffixed by FullBuildMetaData.")]
3535
public string? InformationalVersion { get; set; }
3636

37+
[JsonPropertyDescription("A custom version, suitable for package managers, e.g. NuGet, with appropriate formatting. Defaults to SemVer.")]
38+
public string? CustomVersion { get; set; }
39+
3740
[JsonPropertyDescription("The major version. Should be incremented on breaking changes.")]
3841
public int? Major { get; set; }
3942

0 commit comments

Comments
 (0)