GitVersion
GitVersion copied to clipboard
Defaults for pre-release-weight
We are using WeightedPreReleaseNumber to create a unique and increasing version number. Everything works fine in principle. However, when releasing a new beta we need to manually change the tag and the pre-release-weight in the configuration file. Is there a way to specify that certain pre-releases correspond to given weights, so that a simple push of a tag 2.0.0-beta is sufficient to set the correct pre-release-label and pre-release-weight?
Will the fix implemented in #2003 help in any way?
@asbjornu @pi3k14 As far as I understand https://github.com/GitTools/GitVersion/pull/2003, it improves the calculation of the commits-since-tag value. Thus, it doesn't resolve this issue with the pre-release-weight.
@tobiasdiez #2003 improves the calculation of PreReleaseNumber. I understand that pre-release-weight is used together with PreReleaseNumber to calculate the actual PreReleaseTag (but I don't know much about the concept).
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. Thank you for your contributions.
There is still no solution if I'm not mistaken...
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. Thank you for your contributions.
...
@tobiasdiez, we accept pull requests. As you seem to be the only person interested in this feature, I think you will have to take it upon yourself to implement it. There is no paid labour to work on GitVersion. We are all investing our spare time on this.
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. Thank you for your contributions.
Still relevant for us. I haven't found the time to dive into the code yet, so if somebody else would like to implement it, that would be awesome.
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. Thank you for your contributions.
...
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. Thank you for your contributions.
...
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. Thank you for your contributions.
Still not implemented.
If you see the following figure then we have alread a fallback mechanism:

Unfortunately the branch related property PreReleaseWeight defaults to zero if it has not been specified. Thus maybe we need to consolidate the property LabelPreReleaseWeight (in GitVersionConfiguration) and PreReleaseWeight (in BranchConfiguration) to one property and make it branch related!?
@tobiasdiez Could you please provide us an integration test to illustrate and ensure your scenario? Please take the version from main branch.
[Test]
public void IntegrationTest()
{
var configuration = GitHubFlowConfigurationBuilder.New
.WithBranch("main", branchBuilder => branchBuilder
.WithVersioningMode(VersioningMode.ContinuousDelivery)
.WithLabel("gamma").WithIncrement(IncrementStrategy.Patch)
).Build();
using var fixture = new EmptyRepositoryFixture("main");
fixture.MakeACommit();
// ✅ succeeds as expected
fixture.AssertFullSemver("0.0.1-gamma.1+1", configuration);
fixture.ApplyTag($"0.0.{patchNumber}-alpha.1");
// ❌ expected: 0.0.{patchNumber}-gamma.1+1
fixture.AssertFullSemver($"0.0.{patchNumber}-gamma.1+0", configuration);
}
I don't know how to write a test for this, as it concerns a missing feature and not a bug.
Essentially, what we would like to have is a customizable mapping from commited tags to the default pre-release-weight and pre-release-label, say
alpha -> 15000, 'alpha'
beta -> 30000, 'test'
Then WeightedPreReleaseNumber and PreReleaseLabel should be the following:
- No tag, first commit: 1, ''
- Tag with alpha: 15001, 'alpha'
- next commit: 15002, 'alpha'
- Tag with beta: 30001, 'test'
Okay great idea. Please feel free and implement this feature if you need this and provide a PR. :)
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.
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.
This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions