GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

[Feature] Use weights in pre-release tags.

Open ganju001 opened this issue 1 year ago • 2 comments

GitVersion has WeightedPreReleaseNumber but it is not used in generating/incrementing of prerelease tag. We can specify pre-release-weight but as if it is ignored in semver.

It would be nice to have an configuration in the GitVersion.yaml to enable usage of weights pre-release tags.

In example:

  release:
    regex: ^releases?[/-]
    mode: ContinuousDeployment
    tag: beta
    increment: None
    prevent-increment-of-merged-branch-version: true
    track-merge-target: false
    source-branches: [ 'develop', 'main', 'support', 'release' ]
    tracks-release-branches: false
    is-release-branch: true
    is-mainline: false
    pre-release-weight: 40000

Expected behavior: Semver to be: 2.0.2-beta.40001; 2.0.2-beta.40002; 2.0.2-beta.40003;

Actual behavior: Semver to be: 2.0.2-beta.1; 2.0.2-beta.2; 2.0.2-beta.3;

Context

Using weights would produce correct AssemblyFileSemVer automatically. It would require no hack to use custom assembly version format as assembly-file-versioning-format: MajorMinorPatchTag would work as expected. Weighted tagging should work also.

Possible Implementation

I did not dig much in the GitVersion source but I believe It would be possible to keep track of the config and keep the weight added on parsing tags and calculating versions.

ganju001 avatar Dec 13 '23 12:12 ganju001

Hello @ganju001,

Could you please give me more information about the context why you need this feature and about the motivation around it? In my opinion the pre-release weight is only useful in such cases you cannot handle the semantic version scheme. This is the case in assembly version or assembly file version because you have just four digits seperated with a dot. Like you mentioned it is already possible with the configuration:

assembly-versioning-format: '{MajorMinorPatch}.{WeightedPreReleaseNumber}'
assembly-file-versioning-format: '{MajorMinorPatch}.{WeightedPreReleaseNumber}'
assembly-informational-format: '{MajorMinorPatch}.{WeightedPreReleaseNumber}'

Why should you use a weighted pre-release number for e.g. tagging?

HHobeck avatar Jan 04 '24 11:01 HHobeck

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

github-actions[bot] avatar Apr 04 '24 11:04 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions

github-actions[bot] avatar May 05 '24 11:05 github-actions[bot]