diff --git a/BREAKING_CHANGES.md b/BREAKING_CHANGES.md index 637383c567..7ac3dde2dc 100644 --- a/BREAKING_CHANGES.md +++ b/BREAKING_CHANGES.md @@ -39,7 +39,7 @@ * ContinuousDelivery (previously ContinuousDeployment) * ContinuousDeployment (new) * At the configuration root level, a new array called `strategies` has been introduced, which can consist of on or more following values: - * ConfigNextVersion + * ConfiguredNextVersion * MergeMessage * TaggedCommit * TrackReleaseBranches diff --git a/docs/input/docs/reference/configuration.md b/docs/input/docs/reference/configuration.md index d1fab07dea..f4f6bb5e3a 100644 --- a/docs/input/docs/reference/configuration.md +++ b/docs/input/docs/reference/configuration.md @@ -43,7 +43,6 @@ The global configuration looks like this: assembly-versioning-scheme: MajorMinorPatch assembly-file-versioning-scheme: MajorMinorPatch tag-prefix: '[vV]?' -version-in-branch-pattern: (?[vV]?\d+(\.\d+)?(\.\d+)?).* major-version-bump-message: '\+semver:\s?(breaking|major)' minor-version-bump-message: '\+semver:\s?(feature|minor)' patch-version-bump-message: '\+semver:\s?(fix|patch)' @@ -53,30 +52,21 @@ commit-date-format: yyyy-MM-dd merge-message-formats: {} update-build-number: true semantic-version-format: Strict -strategies: -- ConfigNextVersion -- MergeMessage -- TaggedCommit -- TrackReleaseBranches -- VersionInBranchName +strategies: [ConfigNext, MergeMessage, TaggedCommit, TrackReleaseBranches, VersionInBranchName] branches: develop: - tracks-release-branches: true - is-release-branch: false - is-main-branch: false - pre-release-weight: 0 + mode: ContinuousDeployment label: alpha increment: Minor prevent-increment-of-merged-branch-version: false track-merge-target: true regex: ^dev(elop)?(ment)?$ source-branches: [] - is-source-branch-for: [] - main: - tracks-release-branches: false + tracks-release-branches: true is-release-branch: false - is-main-branch: true - pre-release-weight: 55000 + is-main-branch: false + pre-release-weight: 0 + main: label: '' increment: Patch prevent-increment-of-merged-branch-version: true @@ -85,13 +75,11 @@ branches: source-branches: - develop - release - is-source-branch-for: [] - release: tracks-release-branches: false - is-release-branch: true - is-main-branch: false - pre-release-weight: 30000 - mode: ManualDeployment + is-release-branch: false + is-main-branch: true + pre-release-weight: 55000 + release: label: beta increment: None prevent-increment-of-merged-branch-version: true @@ -102,10 +90,12 @@ branches: - main - support - release - is-source-branch-for: [] - feature: + tracks-release-branches: false + is-release-branch: true + is-main-branch: false pre-release-weight: 30000 - mode: ManualDeployment + feature: + mode: ContinuousDelivery label: '{BranchName}' increment: Inherit regex: ^features?[/-](?.+) @@ -116,9 +106,8 @@ branches: - feature - support - hotfix - is-source-branch-for: [] - pull-request: pre-release-weight: 30000 + pull-request: mode: ContinuousDelivery label: PullRequest increment: Inherit @@ -131,11 +120,9 @@ branches: - feature - support - hotfix - is-source-branch-for: [] - hotfix: - is-release-branch: true pre-release-weight: 30000 - mode: ManualDeployment + hotfix: + mode: ContinuousDelivery label: beta increment: Inherit regex: ^hotfix(es)?[/-] @@ -144,12 +131,8 @@ branches: - main - support - hotfix - is-source-branch-for: [] + pre-release-weight: 30000 support: - tracks-release-branches: false - is-release-branch: false - is-main-branch: true - pre-release-weight: 55000 label: '' increment: Patch prevent-increment-of-merged-branch-version: true @@ -157,12 +140,15 @@ branches: regex: ^support[/-] source-branches: - main - is-source-branch-for: [] + tracks-release-branches: false + is-release-branch: false + is-main-branch: true + pre-release-weight: 55000 unknown: - mode: ManualDeployment + mode: ContinuousDelivery label: '{BranchName}' increment: Inherit - regex: (?.+) + regex: (?.*) source-branches: - main - develop @@ -171,7 +157,6 @@ branches: - pull-request - hotfix - support - is-source-branch-for: [] ignore: sha: [] mode: ContinuousDelivery @@ -182,8 +167,6 @@ track-merge-target: false track-merge-message: true commit-message-incrementing: Enabled regex: '' -source-branches: [] -is-source-branch-for: [] tracks-release-branches: false is-release-branch: false is-main-branch: false @@ -694,7 +677,7 @@ Example of invalid `Strict`, but valid `Loose` ### strategies Specifies which version strategy implementation (one ore more) will be used to determine the next version. Following values are supported and can be combined: -* ConfigNextVersion +* ConfiguredNextVersion * MergeMessage * TaggedCommit * TrackReleaseBranches diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt index 217cd4a332..5ec390d2d5 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.CanWriteOutEffectiveConfiguration.approved.txt @@ -12,7 +12,7 @@ merge-message-formats: {} update-build-number: true semantic-version-format: Strict strategies: -- ConfigNextVersion +- ConfiguredNextVersion - MergeMessage - TaggedCommit - TrackReleaseBranches diff --git a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs index 44c847034e..de631d05bf 100644 --- a/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs +++ b/src/GitVersion.Configuration.Tests/Configuration/ConfigurationProviderTests.cs @@ -60,13 +60,13 @@ public void OverwritesDefaultsWithProvidedConfig() public void CombineVersionStrategyConfigNextAndTaggedCommit() { // Arrange - SetupConfigFileContent("strategies: [ConfigNextVersion, TaggedCommit]"); + SetupConfigFileContent("strategies: [ConfiguredNextVersion, TaggedCommit]"); // Act var configuration = this.configurationProvider.ProvideForDirectory(this.repoPath); // Assert - configuration.VersionStrategy.ShouldBe(VersionStrategies.ConfigNextVersion | VersionStrategies.TaggedCommit); + configuration.VersionStrategy.ShouldBe(VersionStrategies.ConfiguredNextVersion | VersionStrategies.TaggedCommit); } [Test] diff --git a/src/GitVersion.Configuration/GitVersionConfiguration.cs b/src/GitVersion.Configuration/GitVersionConfiguration.cs index ef2d39a602..5700548f0f 100644 --- a/src/GitVersion.Configuration/GitVersionConfiguration.cs +++ b/src/GitVersion.Configuration/GitVersionConfiguration.cs @@ -129,7 +129,7 @@ public string? NextVersion ? VersionCalculation.VersionStrategies.None : VersionStrategies.Aggregate((one, another) => one | another); [JsonPropertyName("strategies")] - [JsonPropertyDescription($"Specifies which version strategies (one or more) will be used to determine the next version. Following values are available: 'ConfigNextVersion', 'MergeMessage', 'TaggedCommit', 'TrackReleaseBranches', 'VersionInBranchName' and 'TrunkBased'.")] + [JsonPropertyDescription($"Specifies which version strategies (one or more) will be used to determine the next version. Following values are available: 'ConfiguredNextVersion', 'MergeMessage', 'TaggedCommit', 'TrackReleaseBranches', 'VersionInBranchName' and 'TrunkBased'.")] public VersionStrategies[] VersionStrategies { get; internal set; } = []; [JsonIgnore] diff --git a/src/GitVersion.Configuration/SupportedWorkflows/TrunkBased/v1.yml b/src/GitVersion.Configuration/SupportedWorkflows/TrunkBased/v1.yml index 68ef302f42..3289a1b7b9 100644 --- a/src/GitVersion.Configuration/SupportedWorkflows/TrunkBased/v1.yml +++ b/src/GitVersion.Configuration/SupportedWorkflows/TrunkBased/v1.yml @@ -10,7 +10,7 @@ commit-date-format: yyyy-MM-dd merge-message-formats: {} update-build-number: true semantic-version-format: Strict -strategies: [TrunkBased, ConfigNextVersion] +strategies: [TrunkBased, ConfiguredNextVersion] branches: main: mode: ContinuousDeployment diff --git a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs index 78b9453adc..e652bbfa37 100644 --- a/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs +++ b/src/GitVersion.Core.Tests/VersionCalculation/Strategies/ConfigNextVersionBaseVersionStrategyTests.cs @@ -7,7 +7,7 @@ namespace GitVersion.Core.Tests.VersionCalculation.Strategies; [TestFixture] -public class ConfigNextVersionBaseVersionStrategyTests : TestBase +public class ConfiguredNextVersionBaseVersionStrategyTests : TestBase { [Test] public void ReturnsNullWhenNoNextVersionIsInConfig() @@ -22,7 +22,7 @@ public void ReturnsNullWhenNoNextVersionIsInConfig() [TestCase("2.12.654651698", "2.12.654651698", SemanticVersionFormat.Strict)] [TestCase("2.12.654651698", "2.12.654651698", SemanticVersionFormat.Loose)] [TestCase("0.1", "0.1.0", SemanticVersionFormat.Loose)] - public void ConfigNextVersionTest(string nextVersion, string expectedVersion, SemanticVersionFormat versionFormat) + public void ConfiguredNextVersionTest(string nextVersion, string expectedVersion, SemanticVersionFormat versionFormat) { var overrideConfiguration = new Dictionary { @@ -37,7 +37,7 @@ public void ConfigNextVersionTest(string nextVersion, string expectedVersion, Se } [TestCase("0.1", SemanticVersionFormat.Strict)] - public void ConfigNextVersionTestShouldFail(string nextVersion, SemanticVersionFormat versionFormat) + public void ConfiguredNextVersionTestShouldFail(string nextVersion, SemanticVersionFormat versionFormat) { var overrideConfiguration = new Dictionary { @@ -54,7 +54,7 @@ public void ConfigNextVersionTestShouldFail(string nextVersion, SemanticVersionF var contextBuilder = new GitVersionContextBuilder().WithOverrideConfiguration(overrideConfiguration); contextBuilder.Build(); contextBuilder.ServicesProvider.ShouldNotBeNull(); - var strategy = contextBuilder.ServicesProvider.GetServiceForType(); + var strategy = contextBuilder.ServicesProvider.GetServiceForType(); var context = contextBuilder.ServicesProvider.GetRequiredService>().Value; var branchMock = GitToolsTestingExtensions.CreateMockBranch("main", GitToolsTestingExtensions.CreateMockCommit()); diff --git a/src/GitVersion.Core/Configuration/ConfigurationConstants.cs b/src/GitVersion.Core/Configuration/ConfigurationConstants.cs index 72f490a3d1..b3a8ffa6ef 100644 --- a/src/GitVersion.Core/Configuration/ConfigurationConstants.cs +++ b/src/GitVersion.Core/Configuration/ConfigurationConstants.cs @@ -15,7 +15,7 @@ internal static class ConfigurationConstants public const AssemblyFileVersioningScheme DefaultAssemblyFileVersioningScheme = AssemblyFileVersioningScheme.MajorMinorPatch; public const SemanticVersionFormat DefaultSemanticVersionFormat = SemanticVersionFormat.Strict; public static readonly VersionStrategies[] DefaultVersionStrategies = [ - VersionStrategies.ConfigNextVersion, + VersionStrategies.ConfiguredNextVersion, VersionStrategies.MergeMessage, VersionStrategies.TaggedCommit, VersionStrategies.TrackReleaseBranches, diff --git a/src/GitVersion.Core/PublicAPI.Unshipped.txt b/src/GitVersion.Core/PublicAPI.Unshipped.txt index 49b867c007..4354ea2d72 100644 --- a/src/GitVersion.Core/PublicAPI.Unshipped.txt +++ b/src/GitVersion.Core/PublicAPI.Unshipped.txt @@ -724,7 +724,7 @@ GitVersion.VersionCalculation.VersionCalculationModule GitVersion.VersionCalculation.VersionCalculationModule.RegisterTypes(Microsoft.Extensions.DependencyInjection.IServiceCollection! services) -> void GitVersion.VersionCalculation.VersionCalculationModule.VersionCalculationModule() -> void GitVersion.VersionCalculation.VersionStrategies -GitVersion.VersionCalculation.VersionStrategies.ConfigNextVersion = 1 -> GitVersion.VersionCalculation.VersionStrategies +GitVersion.VersionCalculation.VersionStrategies.ConfiguredNextVersion = 1 -> GitVersion.VersionCalculation.VersionStrategies GitVersion.VersionCalculation.VersionStrategies.MergeMessage = 2 -> GitVersion.VersionCalculation.VersionStrategies GitVersion.VersionCalculation.VersionStrategies.None = 0 -> GitVersion.VersionCalculation.VersionStrategies GitVersion.VersionCalculation.VersionStrategies.TaggedCommit = 4 -> GitVersion.VersionCalculation.VersionStrategies diff --git a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/ConfigNextVersionVersionStrategy.cs b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/ConfiguredNextVersionVersionStrategy.cs similarity index 85% rename from src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/ConfigNextVersionVersionStrategy.cs rename to src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/ConfiguredNextVersionVersionStrategy.cs index 60078018fa..aee6524a66 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/ConfigNextVersionVersionStrategy.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionSearchStrategies/ConfiguredNextVersionVersionStrategy.cs @@ -8,11 +8,11 @@ namespace GitVersion.VersionCalculation; /// BaseVersionSource is null. /// Does not increment. /// -internal class ConfigNextVersionVersionStrategy(Lazy versionContext) : VersionStrategyBase(versionContext) +internal class ConfiguredNextVersionVersionStrategy(Lazy versionContext) : VersionStrategyBase(versionContext) { public override IEnumerable GetBaseVersions(EffectiveBranchConfiguration configuration) { - if (!Context.Configuration.VersionStrategy.HasFlag(VersionStrategies.ConfigNextVersion)) + if (!Context.Configuration.VersionStrategy.HasFlag(VersionStrategies.ConfiguredNextVersion)) yield break; var contextConfiguration = Context.Configuration; diff --git a/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs b/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs index f14793efbd..395a5d38ac 100644 --- a/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs +++ b/src/GitVersion.Core/VersionCalculation/VersionStrategies.cs @@ -4,10 +4,10 @@ namespace GitVersion.VersionCalculation; public enum VersionStrategies { None = 0, - ConfigNextVersion = 1, + ConfiguredNextVersion = 1, MergeMessage = 2, TaggedCommit = 4, TrackReleaseBranches = 8, VersionInBranchName = 16, - TrunkBased = 32, + TrunkBased = 32 }