forked from GitTools/GitVersion
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnrichSemanticVersion.cs
More file actions
22 lines (19 loc) · 1022 Bytes
/
Copy pathEnrichSemanticVersion.cs
File metadata and controls
22 lines (19 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
using GitVersion.Configuration;
using GitVersion.Extensions;
namespace GitVersion.VersionCalculation.Mainline;
internal sealed class EnrichSemanticVersion : IContextPreEnricher
{
public void Enrich(MainlineIteration iteration, MainlineCommit commit, MainlineContext context)
{
var branchSpecificLabel = context.TargetLabel;
branchSpecificLabel ??= iteration.GetEffectiveConfiguration(context.Configuration)
.GetBranchSpecificLabel(commit.BranchName, null, context.Environemnt);
branchSpecificLabel ??= commit.GetEffectiveConfiguration(context.Configuration)
.GetBranchSpecificLabel(commit.BranchName, null, context.Environment);
var semanticVersions = commit.SemanticVersions.Where(
element => element.IsMatchForBranchSpecificLabel(branchSpecificLabel)
).ToList();
context.AlternativeSemanticVersions.AddRange(commit.SemanticVersions.Except(semanticVersions));
context.SemanticVersion = semanticVersions.Max();
}
}