Skip to content

Introduce CustomVersion variable #4659

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

phatcher
Copy link
Contributor

Introduces a new output variable CustomVersion and an associated formatting variable custom-version-format

Description

Intent is to allow the user to define an output variable without changing the semantics of existing ones. This can then be used to resolve issues such as providing an appropriate version to tools such as NuGet which do not fully followed semantic versioning rules.

Related Issue

Motivation and Context

See above

How Has This Been Tested?

Additional tests in ConfigurationProviderTest for custom-version-format and updated test outputs elsewhere to align

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Copilot Copilot AI review requested due to automatic review settings August 16, 2025 09:11
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new CustomVersion output variable and associated custom-version-format configuration option to provide users with a customizable version string that doesn't affect existing semantics. This addresses compatibility issues with tools like NuGet that don't fully follow semantic versioning rules.

Key changes:

  • Added CustomVersion property to GitVersionVariables with configurable formatting
  • Introduced custom-version-format configuration option with default value {SemVer}
  • Updated test outputs and documentation to include the new variable

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/GitVersion.Core/OutputVariables/GitVersionVariables.cs Added CustomVersion property to the record and included it in property collections
src/GitVersion.Core/Configuration/IGitVersionConfiguration.cs Added CustomVersionFormat property to configuration interface
src/GitVersion.Configuration/GitVersionConfiguration.cs Implemented CustomVersionFormat configuration property with JSON serialization attributes
src/GitVersion.Core/VersionCalculation/VariableProvider.cs Added logic to format and provide CustomVersion variable
docs/input/docs/reference/variables.md Updated documentation to include CustomVersion variable description
schemas/6.4/GitVersion.configuration.json Added custom-version-format to configuration schema
Various test files Updated approved test outputs to include CustomVersion in generated code

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

1. `patch-version-bump-message`
1. `tag-prefix`
1. `tag-pre-release-weight`
1. `update-build-number`
Copy link
Preview

Copilot AI Aug 16, 2025

Choose a reason for hiding this comment

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

The numbered list has been changed from sequential numbering (2, 3, 4, etc.) to all items being numbered '1'. This makes the list harder to reference and appears to be an unintended formatting change.

Suggested change
1. `update-build-number`
2. `assembly-file-versioning-scheme`
3. `assembly-informational-format`
4. `assembly-versioning-format`
5. `assembly-versioning-scheme`
6. `commit-date-format`
7. `commit-message-incrementing`
8. `custom-version-format`
9. `label`
10. `increment`
11. `major-version-bump-message`
12. `minor-version-bump-message`
13. `mode`
14. `next-version`
15. `no-bump-message`
16. `patch-version-bump-message`
17. `tag-prefix`
18. `tag-pre-release-weight`
19. `update-build-number`

Copilot uses AI. Check for mistakes.

Copy link

@phatcher
Copy link
Contributor Author

@arturcic Why did you revert the doc change on my branch?

Also, confused as to why some of the App tests are failing e.g. WixVersionFileContentTest doesn't have the CustomVersion output, but the module tests pass.

Is there another mechanism other than GitVersionVariables that I need to update?

@phatcher
Copy link
Contributor Author

One other question is whether the changes should be under the 6.4 schema or be bumped to a 6.5 schema?

@arturcic
Copy link
Member

One other question is whether the changes should be under the 6.4 schema or be bumped to a 6.5 schema?

The schema is updated as part of the release

@arturcic
Copy link
Member

@arturcic Why did you revert the doc change on my branch?

Also, confused as to why some of the App tests are failing e.g. WixVersionFileContentTest doesn't have the CustomVersion output, but the module tests pass.

Is there another mechanism other than GitVersionVariables that I need to update?

That's not me who updated, but of you want to change the configuration.md you need to update mdsource instead

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.

2 participants