Add GitInfo NuGet package (#268)
In this PR, I added a NuGet package called GitInfo. It can replace Octobot.RepositoryUrl and display the bot version as the current branch and commit. --------- Signed-off-by: mctaylors <cantsendmails@mctaylors.ru> Signed-off-by: Macintxsh <95250141+mctaylors@users.noreply.github.com>
This commit is contained in:
parent
771750c922
commit
2342116e87
10 changed files with 75 additions and 9 deletions
52
src/BuildInfo.cs
Normal file
52
src/BuildInfo.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
namespace Octobot;
|
||||
|
||||
public static class BuildInfo
|
||||
{
|
||||
public static string RepositoryUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
return ThisAssembly.Git.RepositoryUrl;
|
||||
}
|
||||
}
|
||||
|
||||
public static string IssuesUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
return $"{RepositoryUrl}/issues";
|
||||
}
|
||||
}
|
||||
|
||||
private static string Commit
|
||||
{
|
||||
get
|
||||
{
|
||||
return ThisAssembly.Git.Commit;
|
||||
}
|
||||
}
|
||||
|
||||
private static string Branch
|
||||
{
|
||||
get
|
||||
{
|
||||
return ThisAssembly.Git.Branch;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsDirty
|
||||
{
|
||||
get
|
||||
{
|
||||
return ThisAssembly.Git.IsDirty;
|
||||
}
|
||||
}
|
||||
|
||||
public static string Version
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsDirty ? $"{Branch}-{Commit}-dirty" : $"{Branch}-{Commit}";
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue