Skip to content

Commit 3f33d80

Browse files
CopilotAArnott
andcommitted
Update documentation for versionHeightOffsetAppliesTo
Co-authored-by: AArnott <[email protected]>
1 parent 7fd213f commit 3f33d80

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docfx/docs/versionJson.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ The content of the version.json file is a JSON serialized object with these prop
3434
"precision": "revision" // optional. Use when you want a more precise assembly version than the default major.minor.
3535
},
3636
"versionHeightOffset": "zOffset", // optional. Use when you need to add/subtract a fixed value from the computed version height.
37+
"versionHeightOffsetAppliesTo": "x.y-prerelease", // optional. Specifies the version to which versionHeightOffset applies. When the version changes such that version height would reset, and this doesn't match the new version, versionHeightOffset is ignored.
3738
"semVer1NumericIdentifierPadding": 4, // optional. Use when your -prerelease includes numeric identifiers and need semver1 support.
3839
"gitCommitIdShortFixedLength": 10, // optional. Set the commit ID abbreviation length.
3940
"gitCommitIdShortAutoMinimum": 0, // optional. Set to use the short commit ID abbreviation provided by the git repository.
@@ -85,4 +86,24 @@ that assumes linear versioning.
8586

8687
When the `cloudBuild.buildNumber.includeCommitId.where` property is set to `fourthVersionComponent`, the first 15 bits of the commit hash is used to create the 4th integer in the version number.
8788

89+
## Version Height Offset
90+
91+
The `versionHeightOffset` property allows you to add or subtract a fixed value from the git version height. This is typically used as a temporary workaround when migrating from another versioning system or when correcting version numbering discrepancies.
92+
93+
The `versionHeightOffsetAppliesTo` property can be used in conjunction with `versionHeightOffset` to ensure that the offset is only applied when the version matches a specific value. When the `version` property changes such that the version height would be reset, and `versionHeightOffsetAppliesTo` does not match the new version, the `versionHeightOffset` will be automatically ignored.
94+
95+
This allows version height offsets to implicitly reset as intended when the version changes, without having to manually remove the offset properties from all `version.json` files in the repository.
96+
97+
### Example
98+
99+
```json
100+
{
101+
"version": "1.0-beta",
102+
"versionHeightOffset": 100,
103+
"versionHeightOffsetAppliesTo": "1.0-beta"
104+
}
105+
```
106+
107+
In this example, the offset of 100 will be applied as long as the version remains "1.0-beta". When you update the version to "1.1-alpha" (which would reset the version height), the offset will be automatically ignored because "1.1-alpha" does not match "1.0-beta".
108+
88109
[Learn more about pathFilters](path-filters.md).

0 commit comments

Comments
 (0)