Skip to content

Commit

Permalink
Update build.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
WeihanLi authored Jan 28, 2024
1 parent 954410a commit e2cf62a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions build/build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
var stable = ArgumentBool("stable", false);
var noPush = ArgumentBool("noPush", false);
var branchName = Environment.GetEnvironmentVariable("BUILD_SOURCEBRANCHNAME") ?? "local";
stable |= branchName is "master" or "main";

var solutionPath = "./dotnet-httpie.sln";
string[] srcProjects = ["./src/HTTPie/HTTPie.csproj"];
Expand Down Expand Up @@ -59,7 +60,7 @@ await BuildProcess.CreateBuilder()
.WithDependency("test")
.WithExecution(async () =>
{
if (branchName == "master" || branchName == "main" || stable)
if (stable)
{
foreach (var project in srcProjects)
{
Expand All @@ -83,7 +84,7 @@ await BuildProcess.CreateBuilder()
if (string.IsNullOrEmpty(apiKey))
{
// try to get apiKey from environment variable
// try to get apiKey from the environment variable
apiKey = Environment.GetEnvironmentVariable("NuGet__ApiKey");
if (string.IsNullOrEmpty(apiKey))
Expand All @@ -93,7 +94,7 @@ await BuildProcess.CreateBuilder()
}
}
if (branchName != "master" && branchName != "main" && branchName != "preview")
if (!stable && branchName != "preview")
{
Console.WriteLine($"Skip push since branch name {branchName} not support push packages");
return;
Expand Down

0 comments on commit e2cf62a

Please sign in to comment.