Spit out tag, branch and repo checks

This commit is contained in:
Tomasz Cielecki 2017-04-23 20:18:32 +02:00
Родитель 8f76e422de
Коммит 0cd7062ef1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 356B87B0E298D66F
1 изменённых файлов: 19 добавлений и 7 удалений

Просмотреть файл

@ -246,36 +246,48 @@ RunTarget(target);
bool IsBranch(string branch) bool IsBranch(string branch)
{ {
var buildEnvBranch = string.Empty;
if (isRunningOnAppVeyor) if (isRunningOnAppVeyor)
return StringComparer.OrdinalIgnoreCase.Equals(branch, AppVeyor.Environment.Repository.Branch); buildEnvBranch = AppVeyor.Environment.Repository.Branch;
if (isRunningOnVSTS) if (isRunningOnVSTS)
return StringComparer.OrdinalIgnoreCase.Equals(branch, TFBuild.Environment.Repository.Branch); buildEnvBranch = TFBuild.Environment.Repository.Branch;
return false; Information(string.Format("Checking branch: {0} against build branch: {1}", branch, buildEnvBranch));
return StringComparer.OrdinalIgnoreCase.Equals(branch, buildEnvBranch);
} }
bool IsRepository(string repoName) bool IsRepository(string repoName)
{ {
var buildEnvRepoName = string.Empty;
if (isRunningOnAppVeyor) if (isRunningOnAppVeyor)
return StringComparer.OrdinalIgnoreCase.Equals(repoName, AppVeyor.Environment.Repository.Name); buildEnvRepoName = AppVeyor.Environment.Repository.Name;
if (isRunningOnVSTS) if (isRunningOnVSTS)
return StringComparer.OrdinalIgnoreCase.Equals(repoName, TFBuild.Environment.Repository.RepoName); buildEnvRepoName = TFBuild.Environment.Repository.RepoName;
Information(string.Format("Checking repo name: {0} against build repo name: {1}", repoName, buildEnvRepoName));
return false; return false;
} }
bool IsTagged() bool IsTagged()
{ {
var toReturn = false;
int commitsSinceTag = -1; int commitsSinceTag = -1;
if (int.TryParse(versionInfo.CommitsSinceVersionSource, out commitsSinceTag)) if (int.TryParse(versionInfo.CommitsSinceVersionSource, out commitsSinceTag))
{ {
// if tag is current commit this will be 0 // if tag is current commit this will be 0
if (commitsSinceTag != 0) return false; if (commitsSinceTag == 0)
toReturn = true;
} }
return true; Information(string.Format("Commits since tag {0}, is tagged: {1}", commitsSinceTag, toReturn));
return toReturn;
} }
Tuple<string, string> GetNugetKeyAndSource() Tuple<string, string> GetNugetKeyAndSource()