Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions BREAKING_CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
* TrunkBased
* The initialization wizard has been removed.
* On the `develop`, `release` and `hotfix` branch the introduced branch related property `prevent-increment.when-current-commit-tagged` has been set to `false` to get the incremented instead of the tagged semantic version.
* An exception that no commits found on the current branch will be thrown when the ignore commits before will be set to a future value Behavious now like an empty repository.
## v5.0.0
Expand Down
2 changes: 1 addition & 1 deletion docs/input/docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ branches:
regex: (?<BranchName>.+)
source-branches:
- main
- release
- feature
- hotfix
- pull-request
ignore:
sha: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ branches:
regex: (?<BranchName>.+)
source-branches:
- main
- release
- feature
- hotfix
- pull-request
ignore:
sha: []
Expand Down
122 changes: 122 additions & 0 deletions src/GitVersion.Configuration/TrunkBasedConfigurationBuilder.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
using GitVersion.VersionCalculation;

namespace GitVersion.Configuration;

internal sealed class TrunkBasedConfigurationBuilder : ConfigurationBuilderBase<TrunkBasedConfigurationBuilder>
{
public static TrunkBasedConfigurationBuilder New => new();

private TrunkBasedConfigurationBuilder()
{
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 = [
VersionStrategies.ConfiguredNextVersion,
VersionStrategies.TrunkBased
],
TagPrefix = ConfigurationConstants.DefaultTagPrefix,
VersionInBranchPattern = ConfigurationConstants.DefaultVersionInBranchPattern,
TagPreReleaseWeight = ConfigurationConstants.DefaultTagPreReleaseWeight,
UpdateBuildNumber = ConfigurationConstants.DefaultUpdateBuildNumber,
DeploymentMode = DeploymentMode.ManualDeployment,
RegularExpression = string.Empty,
Label = ConfigurationConstants.BranchNamePlaceholder,
Increment = IncrementStrategy.Inherit,
CommitMessageIncrementing = CommitMessageIncrementMode.Enabled,
PreventIncrement = new PreventIncrementConfiguration()
{
OfMergedBranch = false,
WhenBranchMerged = false,
WhenCurrentCommitTagged = true
},
TrackMergeTarget = false,
TrackMergeMessage = true,
TracksReleaseBranches = false,
IsReleaseBranch = false,
IsMainBranch = false
});

WithBranch(MainBranch.Name).WithConfiguration(new BranchConfiguration()
{
Increment = IncrementStrategy.Patch,
RegularExpression = MainBranch.RegexPattern,
DeploymentMode = DeploymentMode.ContinuousDeployment,
SourceBranches = [],
Label = string.Empty,
PreventIncrement = new PreventIncrementConfiguration()
{
OfMergedBranch = true
},
TrackMergeTarget = false,
TracksReleaseBranches = false,
IsMainBranch = true,
IsReleaseBranch = false,
PreReleaseWeight = 55000
});

WithBranch(FeatureBranch.Name).WithConfiguration(new BranchConfiguration()
{
Increment = IncrementStrategy.Minor,
RegularExpression = FeatureBranch.RegexPattern,
SourceBranches =
[
this.MainBranch.Name
],
PreventIncrement = new PreventIncrementConfiguration()
{
WhenCurrentCommitTagged = false
},
PreReleaseWeight = 30000
});

WithBranch(HotfixBranch.Name).WithConfiguration(new BranchConfiguration()
{
Increment = IncrementStrategy.Patch,
RegularExpression = HotfixBranch.RegexPattern,
SourceBranches =
[
this.MainBranch.Name
],
PreventIncrement = new PreventIncrementConfiguration()
{
WhenCurrentCommitTagged = false
},
PreReleaseWeight = 30000
});

WithBranch(PullRequestBranch.Name).WithConfiguration(new BranchConfiguration
{
Increment = IncrementStrategy.Inherit,
RegularExpression = PullRequestBranch.RegexPattern,
DeploymentMode = DeploymentMode.ManualDeployment,
SourceBranches =
[
this.MainBranch.Name
],
Label = "PullRequest",
LabelNumberPattern = ConfigurationConstants.DefaultLabelNumberPattern,
PreReleaseWeight = 30000
});

WithBranch(UnknownBranch.Name).WithConfiguration(new BranchConfiguration
{
RegularExpression = UnknownBranch.RegexPattern,
DeploymentMode = DeploymentMode.ManualDeployment,
Increment = IncrementStrategy.Inherit,
SourceBranches =
[
this.MainBranch.Name,
this.FeatureBranch.Name,
this.PullRequestBranch.Name
]
});
}
}

This file was deleted.

Loading