If CI build, include build link in version output

[#88]
This commit is contained in:
Chris Cheetham 2019-11-22 11:25:44 -05:00
Родитель c0b18ae3c5
Коммит 458aaf8016
1 изменённых файлов: 8 добавлений и 1 удалений

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

@ -38,8 +38,15 @@ namespace Steeltoe.Cli
public static int Main(string[] args) => CommandLineApplication.Execute<Program>(args); public static int Main(string[] args) => CommandLineApplication.Execute<Program>(args);
public static string GetVersion() public static string GetVersion()
=> typeof(Program).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>() {
var versionString = typeof(Program).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()
.InformationalVersion; .InformationalVersion;
if (!versionString.Contains('-')) return versionString;
var version = versionString.Split('-')[0];
var build = versionString.Split('-')[1];
return
$"{version} (build {build} -> https://dev.azure.com/SteeltoeOSS/Steeltoe/_build/results?buildId={build})";
}
[Option("-C|--config-file", Description = [Option("-C|--config-file", Description =
"Configure tooling using the specified file instead of steeltoe.yaml")] "Configure tooling using the specified file instead of steeltoe.yaml")]