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 2332cbd commit 20b5895
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build/build/Tasks/Test/PublishCoverage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public override bool ShouldRun(BuildContext context)
{
var shouldRun = true;
shouldRun &= context.ShouldRun(context.IsOnWindows, $"{nameof(PublishCoverage)} works only on Windows agents.");
shouldRun &= context.ShouldRun(context.IsOnMainOrReleaseBranchOriginalRepo, $"{nameof(PublishCoverage)} works only for on main or release branch original repository.");
shouldRun &= context.ShouldRun(context.IsOnMainOrSupportBranchOriginalRepo, $"{nameof(PublishCoverage)} works only for on main or release branch original repository.");

return shouldRun;
}
Expand Down
8 changes: 4 additions & 4 deletions build/common/Utilities/BuildContextBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ protected BuildContextBase(ICakeContext context) : base(context)

public bool IsOriginalRepo { get; set; }
public bool IsMainBranch { get; set; }
public bool IsReleaseBranch { get; set; }
public bool IsSupportBranch { get; set; }
public bool IsPullRequest { get; set; }
public bool IsTagged { get; set; }
public bool IsLocalBuild { get; set; }
Expand All @@ -18,7 +18,7 @@ protected BuildContextBase(ICakeContext context) : base(context)
public bool IsOnWindows { get; set; }
public bool IsOnLinux { get; set; }
public bool IsOnMacOS { get; set; }
public bool IsOnMainOrReleaseBranchOriginalRepo => !IsLocalBuild && IsOriginalRepo && (IsMainBranch || IsReleaseBranch) && !IsPullRequest;
public bool IsStableRelease => IsOnMainOrReleaseBranchOriginalRepo && IsTagged;
public bool IsPreRelease => IsOnMainOrReleaseBranchOriginalRepo && !IsTagged;
public bool IsOnMainOrSupportBranchOriginalRepo => !IsLocalBuild && IsOriginalRepo && (IsMainBranch || IsSupportBranch) && !IsPullRequest;
public bool IsStableRelease => IsOnMainOrSupportBranchOriginalRepo && IsTagged;
public bool IsPreRelease => IsOnMainOrSupportBranchOriginalRepo && !IsTagged;
}
6 changes: 3 additions & 3 deletions build/common/Utilities/BuildLifetimeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public override void Setup(T context)
context.IsPullRequest = buildSystem.IsPullRequest;
context.IsOriginalRepo = context.IsOriginalRepo();
context.IsMainBranch = context.IsMainBranch();
context.IsReleaseBranch = context.IsReleaseBranch();
context.IsSupportBranch = context.IsSupportBranch();
context.IsTagged = context.IsTagged();

context.IsOnWindows = context.IsRunningOnWindows();
Expand All @@ -39,7 +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("Main Branch: {0}", context.IsMainBranch);
context.Information("Release Branch: {0}", context.IsReleaseBranch);
context.Information("Support Branch: {0}", context.IsSupportBranch);
context.Information("Tagged: {0}", context.IsTagged);

context.Information("Finished running tasks.");
Expand All @@ -62,7 +62,7 @@ protected void LogBuildInformation(T context)
context.Information("Pull Request: {0}", context.IsPullRequest);
context.Information("Original Repo: {0}", context.IsOriginalRepo);
context.Information("Main Branch: {0}", context.IsMainBranch);
context.Information("Release Branch: {0}", context.IsReleaseBranch);
context.Information("Support Branch: {0}", context.IsSupportBranch);
context.Information("Tagged: {0}", context.IsTagged);
}
}
4 changes: 2 additions & 2 deletions build/common/Utilities/ContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public static bool IsMainBranch(this ICakeContext context)
return !string.IsNullOrWhiteSpace(repositoryBranch) && StringComparer.OrdinalIgnoreCase.Equals("main", repositoryBranch);
}

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

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

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

public static bool IsTagged(this ICakeContext context)
Expand Down
2 changes: 1 addition & 1 deletion build/publish/Tasks/PublishNuget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override bool ShouldRun(BuildContext context)
public override void Run(BuildContext context)
{
// publish to github packages for commits on main and on original repo
if (context.IsGitHubActionsBuild && context.IsOnMainOrReleaseBranchOriginalRepo)
if (context.IsGitHubActionsBuild && context.IsOnMainOrSupportBranchOriginalRepo)
{
var apiKey = context.Credentials?.GitHub?.Token;
if (string.IsNullOrEmpty(apiKey))
Expand Down

0 comments on commit 20b5895

Please sign in to comment.