Skip to content

Commit

Permalink
(build) renamed the release to support branch
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Mar 11, 2022
1 parent 20b5895 commit 3a79a49
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions build/common/Utilities/BuildContextBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ protected BuildContextBase(ICakeContext context) : base(context)
public BuildVersion? Version { get; set; }

public bool IsOriginalRepo { get; set; }
public string BranchName { get; set; } = string.Empty;
public bool IsMainBranch { get; set; }
public bool IsSupportBranch { get; set; }
public bool IsPullRequest { get; set; }
Expand Down
3 changes: 3 additions & 0 deletions build/common/Utilities/BuildLifetimeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public override void Setup(T context)
context.IsGitHubActionsBuild = buildSystem.IsRunningOnGitHubActions;

context.IsPullRequest = buildSystem.IsPullRequest;
context.BranchName = context.GetBranchName();
context.IsOriginalRepo = context.IsOriginalRepo();
context.IsMainBranch = context.IsMainBranch();
context.IsSupportBranch = context.IsSupportBranch();
Expand All @@ -38,6 +39,7 @@ public override void Teardown(T context, ITeardownContext info)

context.Information("Pull Request: {0}", context.IsPullRequest);
context.Information("Original Repo: {0}", context.IsOriginalRepo);
context.Information("Branch Name: {0}", context.BranchName);
context.Information("Main Branch: {0}", context.IsMainBranch);
context.Information("Support Branch: {0}", context.IsSupportBranch);
context.Information("Tagged: {0}", context.IsTagged);
Expand All @@ -61,6 +63,7 @@ protected void LogBuildInformation(T context)
context.Information("OS: {0}", context.GetOS());
context.Information("Pull Request: {0}", context.IsPullRequest);
context.Information("Original Repo: {0}", context.IsOriginalRepo);
context.Information("Branch Name: {0}", context.BranchName);
context.Information("Main Branch: {0}", context.IsMainBranch);
context.Information("Support Branch: {0}", context.IsSupportBranch);
context.Information("Tagged: {0}", context.IsTagged);
Expand Down
11 changes: 2 additions & 9 deletions build/common/Utilities/ContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,13 @@ public static bool IsOriginalRepo(this ICakeContext context)
public static bool IsMainBranch(this ICakeContext context)
{
var repositoryBranch = GetBranchName(context);

context.Information("Repository Branch: {0}", repositoryBranch);

return !string.IsNullOrWhiteSpace(repositoryBranch) && StringComparer.OrdinalIgnoreCase.Equals("main", repositoryBranch);
}

public static bool IsSupportBranch(this ICakeContext context)
{
var repositoryBranch = GetBranchName(context);

context.Information("Repository Branch: {0}", repositoryBranch);

return !string.IsNullOrWhiteSpace(repositoryBranch) && repositoryBranch.StartsWith("suppoer/", StringComparison.OrdinalIgnoreCase);
return !string.IsNullOrWhiteSpace(repositoryBranch) && repositoryBranch.StartsWith("support/", StringComparison.OrdinalIgnoreCase);
}

public static bool IsTagged(this ICakeContext context)
Expand Down Expand Up @@ -172,9 +166,8 @@ public static bool ShouldRun(this ICakeContext context, bool criteria, string sk
return false;
}

private static string GetBranchName(ICakeContext context)
public static string GetBranchName(this ICakeContext context)
{

var buildSystem = context.BuildSystem();
string repositoryBranch = context.ExecGitCmd("rev-parse --abbrev-ref HEAD").Single();
if (buildSystem.IsRunningOnAppVeyor)
Expand Down

0 comments on commit 3a79a49

Please sign in to comment.