Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor PublicRelease environment variable within nbgv get-version #371

Merged
merged 1 commit into from
Aug 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/nbgv/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,13 @@ private static ExitCodes OnGetVersionCommand(string projectPath, string format,
}

var oracle = new VersionOracle(searchPath, repository, commit, CloudBuild.Active);

// Take the PublicRelease environment variable into account, since the build would as well.
if (!string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("PublicRelease")) && bool.TryParse(Environment.GetEnvironmentVariable("PublicRelease"), out bool publicRelease))
{
oracle.PublicRelease = publicRelease;
}

if (string.IsNullOrEmpty(singleVariable))
{
switch (format.ToLowerInvariant())
Expand Down Expand Up @@ -573,7 +580,7 @@ private static ExitCodes OnPrepareReleaseCommand(string projectPath, string prer
}

// nextVersion and versionIncrement parameters cannot be combined
if(!string.IsNullOrEmpty(nextVersion) && !string.IsNullOrEmpty(versionIncrement))
if (!string.IsNullOrEmpty(nextVersion) && !string.IsNullOrEmpty(versionIncrement))
{
Console.Error.WriteLine("Options 'nextVersion' and 'versionIncrement' cannot be used at the same time.");
return ExitCodes.InvalidParameters;
Expand All @@ -583,7 +590,7 @@ private static ExitCodes OnPrepareReleaseCommand(string projectPath, string prer
VersionOptions.ReleaseVersionIncrement? versionIncrementParsed = default;
if (!string.IsNullOrEmpty(versionIncrement))
{
if(!Enum.TryParse< VersionOptions.ReleaseVersionIncrement>(versionIncrement, true, out var parsed))
if (!Enum.TryParse<VersionOptions.ReleaseVersionIncrement>(versionIncrement, true, out var parsed))
{
Console.Error.WriteLine($"\"{versionIncrement}\" is not a valid version increment");
return ExitCodes.InvalidVersionIncrement;
Expand Down