forked from GitTools/GitVersion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGitHubFlowConfigurationBuilder.cs
118 lines (110 loc) · 4.88 KB
/
GitHubFlowConfigurationBuilder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
using GitVersion.VersionCalculation;
namespace GitVersion.Configuration;
internal sealed class GitHubFlowConfigurationBuilder : ConfigurationBuilderBase<GitHubFlowConfigurationBuilder>
{
public static GitHubFlowConfigurationBuilder New => new();
private GitHubFlowConfigurationBuilder()
{
WithConfiguration(new GitVersionConfiguration
{
AssemblyFileVersioningScheme = ConfigurationConstants.DefaultAssemblyFileVersioningScheme,
AssemblyVersioningScheme = ConfigurationConstants.DefaultAssemblyVersioningScheme,
CommitDateFormat = ConfigurationConstants.DefaultCommitDateFormat,
MajorVersionBumpMessage = IncrementStrategyFinder.DefaultMajorPattern,
MinorVersionBumpMessage = IncrementStrategyFinder.DefaultMinorPattern,
NoBumpMessage = IncrementStrategyFinder.DefaultNoBumpPattern,
PatchVersionBumpMessage = IncrementStrategyFinder.DefaultPatchPattern,
SemanticVersionFormat = ConfigurationConstants.DefaultSemanticVersionFormat,
VersionStrategies = ConfigurationConstants.DefaultVersionStrategies,
TagPrefix = ConfigurationConstants.DefaultTagPrefix,
VersionInBranchPattern = ConfigurationConstants.DefaultVersionInBranchPattern,
TagPreReleaseWeight = ConfigurationConstants.DefaultTagPreReleaseWeight,
UpdateBuildNumber = ConfigurationConstants.DefaultUpdateBuildNumber,
DeploymentMode = DeploymentMode.ContinuousDelivery,
RegularExpression = string.Empty,
Label = ConfigurationConstants.BranchNamePlaceholder,
Increment = IncrementStrategy.Inherit,
CommitMessageIncrementing = CommitMessageIncrementMode.Enabled,
PreventIncrementOfMergedBranchVersion = false,
TrackMergeTarget = false,
TrackMergeMessage = true,
TracksReleaseBranches = false,
IsReleaseBranch = false,
IsMainBranch = false
});
WithBranch(MainBranch.Name).WithConfiguration(new BranchConfiguration
{
Increment = IncrementStrategy.Patch,
RegularExpression = MainBranch.RegexPattern,
SourceBranches = [this.ReleaseBranch.Name],
Label = string.Empty,
PreventIncrementOfMergedBranchVersion = true,
TrackMergeTarget = false,
TracksReleaseBranches = false,
IsMainBranch = true,
IsReleaseBranch = false,
PreReleaseWeight = 55000
});
WithBranch(ReleaseBranch.Name).WithConfiguration(new BranchConfiguration
{
Increment = IncrementStrategy.None,
RegularExpression = ReleaseBranch.RegexPattern,
DeploymentMode = DeploymentMode.ManualDeployment,
SourceBranches =
[
this.MainBranch.Name,
this.ReleaseBranch.Name
],
Label = "beta",
PreventIncrementOfMergedBranchVersion = true,
TrackMergeTarget = false,
TracksReleaseBranches = false,
IsMainBranch = false,
IsReleaseBranch = true,
PreReleaseWeight = 30000
});
WithBranch(FeatureBranch.Name).WithConfiguration(new BranchConfiguration
{
Increment = IncrementStrategy.Inherit,
RegularExpression = FeatureBranch.RegexPattern,
DeploymentMode = DeploymentMode.ManualDeployment,
SourceBranches =
[
this.MainBranch.Name,
this.ReleaseBranch.Name,
this.FeatureBranch.Name
],
Label = ConfigurationConstants.BranchNamePlaceholder,
PreReleaseWeight = 30000
});
WithBranch(PullRequestBranch.Name).WithConfiguration(new BranchConfiguration
{
Increment = IncrementStrategy.Inherit,
RegularExpression = PullRequestBranch.RegexPattern,
DeploymentMode = DeploymentMode.ContinuousDelivery,
SourceBranches =
[
this.MainBranch.Name,
this.ReleaseBranch.Name,
this.FeatureBranch.Name
],
Label = "PullRequest",
LabelNumberPattern = ConfigurationConstants.DefaultLabelNumberPattern,
PreReleaseWeight = 30000
});
WithBranch(UnknownBranch.Name).WithConfiguration(new BranchConfiguration
{
RegularExpression = UnknownBranch.RegexPattern,
Label = ConfigurationConstants.BranchNamePlaceholder,
DeploymentMode = DeploymentMode.ManualDeployment,
Increment = IncrementStrategy.Inherit,
SourceBranches =
[
this.MainBranch.Name,
this.ReleaseBranch.Name,
this.FeatureBranch.Name,
this.PullRequestBranch.Name
]
});
}
}