Skip to content

Commit 1182248

Browse files
committed
feat(ci): Add support for 'next' release branches
Integrate 'next/*' branch pattern into CI workflows and build context. Renames `IsStableRelease` to `IsTaggedRelease` and includes `next` branches in its definition for clear release status.
1 parent 6cbb005 commit 1182248

18 files changed

Lines changed: 42 additions & 15 deletions

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- 'feature/*'
99
- 'poc/*'
1010
- 'support/*'
11+
- 'next/*'
1112
paths:
1213
- '**'
1314
- '!docs/**'
@@ -16,6 +17,7 @@ on:
1617
branches:
1718
- main
1819
- 'support/*'
20+
- 'next/*'
1921
paths:
2022
- '**'
2123
- '!docs/**'

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches:
66
- main
77
- 'support/*'
8+
- 'next/*'
89
paths:
910
- '**'
1011
- '!docs/**'
@@ -15,6 +16,7 @@ on:
1516
branches:
1617
- main
1718
- 'support/*'
19+
- 'next/*'
1820
paths:
1921
- '**'
2022
- '!docs/**'

.github/workflows/format.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- 'feature/*'
88
- 'poc/*'
99
- 'support/*'
10+
- 'next/*'
1011
paths:
1112
- '**'
1213
- '!docs/**'
@@ -17,6 +18,7 @@ on:
1718
branches:
1819
- main
1920
- 'support/*'
21+
- 'next/*'
2022
paths:
2123
- '**'
2224
- '!docs/**'

.github/workflows/mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ on:
77
- 'feature/*'
88
- 'poc/*'
99
- 'support/*'
10+
- 'next/*'
1011
paths:
1112
- 'docs/**'
1213

1314
pull_request:
1415
branches:
1516
- main
1617
- 'support/*'
18+
- 'next/*'
1719
paths:
1820
- 'docs/**'
1921

.github/workflows/new-cli.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- 'feature/*'
88
- 'poc/*'
99
- 'support/*'
10+
- 'next/*'
1011
paths:
1112
- '**'
1213
- '!docs/**'
@@ -17,6 +18,7 @@ on:
1718
branches:
1819
- main
1920
- 'support/*'
21+
- 'next/*'
2022
paths:
2123
- '**'
2224
- '!docs/**'

build/common/Lifetime/BuildLifetimeBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public override void Setup(T context, ISetupContext info)
1919
context.IsOriginalRepo = context.IsOriginalRepo();
2020
context.IsMainBranch = context.IsMainBranch();
2121
context.IsSupportBranch = context.IsSupportBranch();
22+
context.IsNextBranch = context.IsNextBranch();
2223
context.IsTagged = context.IsTagged();
2324

2425
context.IsOnWindows = context.IsRunningOnWindows();
@@ -83,8 +84,9 @@ protected void LogBuildInformation(T context)
8384
context.Information($"Branch Name: {context.BranchName}");
8485
context.Information($"Main Branch: {context.IsMainBranch}");
8586
context.Information($"Support Branch: {context.IsSupportBranch}");
87+
context.Information($"Next Branch: {context.IsNextBranch}");
8688
context.Information($"Tagged: {context.IsTagged}");
87-
context.Information($"IsStableRelease: {context.IsStableRelease}");
89+
context.Information($"IsTaggedRelease: {context.IsTaggedRelease}");
8890
context.Information($"IsTaggedPreRelease: {context.IsTaggedPreRelease}");
8991
context.Information($"IsInternalPreRelease: {context.IsInternalPreRelease}");
9092
}

build/common/Utilities/BuildContextBase.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class BuildContextBase : FrostingContext
1010
public string RepositoryName { get; set; } = string.Empty;
1111
public bool IsMainBranch { get; set; }
1212
public bool IsSupportBranch { get; set; }
13+
public bool IsNextBranch { get; set; }
1314
public bool IsPullRequest { get; set; }
1415
public bool IsTagged { get; set; }
1516
public bool IsLocalBuild { get; set; }
@@ -18,8 +19,8 @@ public class BuildContextBase : FrostingContext
1819
public bool IsOnWindows { get; set; }
1920
public bool IsOnLinux { get; set; }
2021
public bool IsOnMacOS { get; set; }
21-
public bool IsReleaseBranchOriginalRepo => !IsLocalBuild && IsOriginalRepo && (IsMainBranch || IsSupportBranch) && !IsPullRequest;
22-
public bool IsStableRelease => IsReleaseBranchOriginalRepo && IsTagged && Version?.IsPreRelease == false;
22+
public bool IsReleaseBranchOriginalRepo => !IsLocalBuild && IsOriginalRepo && (IsMainBranch || IsSupportBranch || IsNextBranch) && !IsPullRequest;
23+
public bool IsTaggedRelease => IsReleaseBranchOriginalRepo && IsTagged && Version?.IsPreRelease == false;
2324
public bool IsTaggedPreRelease => IsReleaseBranchOriginalRepo && IsTagged && Version?.IsPreRelease == true;
2425
public bool IsInternalPreRelease => IsReleaseBranchOriginalRepo && IsGitHubActionsBuild;
2526
}

build/common/Utilities/CakeHostExtensions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Common.Utilities;
44

5+
#pragma warning disable S1144
56
public static class ServicesExtensions
67
{
78
extension(CakeHost host)
@@ -25,3 +26,4 @@ public CakeHost InstallNugetTool(string toolName, string toolVersion)
2526
}
2627
}
2728
}
29+
#pragma warning restore S1144

build/common/Utilities/ContextExtensions.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace Common.Utilities;
77

8+
#pragma warning disable S1144
89
public static class ContextExtensions
910
{
1011
extension(ICakeContext context)
@@ -41,16 +42,22 @@ public bool IsOriginalRepo()
4142

4243
public bool IsMainBranch()
4344
{
44-
var repositoryBranch = GetBranchName(context);
45+
var repositoryBranch = context.GetBranchName();
4546
return !string.IsNullOrWhiteSpace(repositoryBranch) && StringComparer.OrdinalIgnoreCase.Equals(Constants.DefaultBranch, repositoryBranch);
4647
}
4748

4849
public bool IsSupportBranch()
4950
{
50-
var repositoryBranch = GetBranchName(context);
51+
var repositoryBranch = context.GetBranchName();
5152
return !string.IsNullOrWhiteSpace(repositoryBranch) && repositoryBranch.StartsWith("support/", StringComparison.OrdinalIgnoreCase);
5253
}
5354

55+
public bool IsNextBranch()
56+
{
57+
var repositoryBranch = context.GetBranchName();
58+
return !string.IsNullOrWhiteSpace(repositoryBranch) && repositoryBranch.StartsWith("next/", StringComparison.OrdinalIgnoreCase);
59+
}
60+
5461
public bool IsTagged()
5562
{
5663
var sha = context.ExecGitCmd("rev-parse --verify HEAD").Single();
@@ -192,3 +199,4 @@ public string GetRepositoryName()
192199
private void EndGroup(ICakeContext context) => context.Information("##[endgroup]");
193200
}
194201
}
202+
#pragma warning restore S1144

build/common/Utilities/DockerContextExtensions.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public enum Architecture
1010
Amd64
1111
}
1212

13+
#pragma warning disable S1144
1314
public static class DockerContextExtensions
1415
{
1516
private static readonly string[] Annotations =
@@ -169,7 +170,7 @@ private void DockerTestRun(string image, Architecture arch, string command,
169170
params string[] args)
170171
{
171172
ArgumentNullException.ThrowIfNull(context.Version?.GitVersion.FullSemVer);
172-
var settings = GetDockerRunSettings(context, arch);
173+
var settings = context.GetDockerRunSettings(arch);
173174
context.Information($"Testing image: {image}");
174175
var output = context.DockerRun(settings, image, command, args);
175176
context.Information("Output : " + output);
@@ -195,7 +196,7 @@ private IEnumerable<string> GetDockerTags(DockerImage dockerImage,
195196
{
196197
tags.Add($"{name}:{context.Version.SemVersion}");
197198

198-
if (context.IsStableRelease)
199+
if (context.IsTaggedRelease)
199200
{
200201
tags.AddRange(
201202
[
@@ -279,3 +280,4 @@ .. Annotations.Select(a => "index:" + a).ToArray(),
279280
return settings;
280281
}
281282
}
283+
#pragma warning restore S1144

0 commit comments

Comments
 (0)