Add build to FullVersion

This commit is contained in:
jvyden 2021-11-23 00:24:37 -05:00
commit 87f16e3869
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
3 changed files with 15 additions and 6 deletions

View file

@ -6,9 +6,9 @@ using LBPUnion.ProjectLighthouse.Types.Settings;
namespace LBPUnion.ProjectLighthouse.Helpers namespace LBPUnion.ProjectLighthouse.Helpers
{ {
public static class GitVersionHelper public static class VersionHelper
{ {
static GitVersionHelper() static VersionHelper()
{ {
try try
{ {
@ -51,8 +51,17 @@ namespace LBPUnion.ProjectLighthouse.Helpers
public static string CommitHash { get; set; } public static string CommitHash { get; set; }
public static string Branch { get; set; } public static string Branch { get; set; }
public static string FullVersion => $"{ServerStatics.ServerName} {Branch}@{CommitHash}"; public static string FullVersion => $"{ServerStatics.ServerName} {Branch}@{CommitHash} {Build}";
public static bool IsDirty => CommitHash.EndsWith("-dirty"); public static bool IsDirty => CommitHash.EndsWith("-dirty");
public static bool CanCheckForUpdates { get; set; } public static bool CanCheckForUpdates { get; set; }
public const string Build =
#if DEBUG
"Debug";
#elif RELEASE
"Release";
#else
"Unknown";
#endif
} }
} }

View file

@ -69,8 +69,8 @@
<div class="ui black attached inverted segment"> <div class="ui black attached inverted segment">
<div class="ui container"> <div class="ui container">
<p>Page generated by @GitVersionHelper.FullVersion.</p> <p>Page generated by @VersionHelper.FullVersion.</p>
@if (GitVersionHelper.IsDirty) @if (VersionHelper.IsDirty)
{ {
<p>This page was generated using a modified version of Project Lighthouse. Please make sure you are properly disclosing the source code to any users who may be using this instance.</p> <p>This page was generated using a modified version of Project Lighthouse. Please make sure you are properly disclosing the source code to any users who may be using this instance.</p>
} }

View file

@ -29,7 +29,7 @@ namespace LBPUnion.ProjectLighthouse
Logger.AddLogger(new LighthouseFileLogger()); Logger.AddLogger(new LighthouseFileLogger());
Logger.Log("Welcome to Project Lighthouse!", LoggerLevelStartup.Instance); Logger.Log("Welcome to Project Lighthouse!", LoggerLevelStartup.Instance);
Logger.Log($"Running {GitVersionHelper.FullVersion}", LoggerLevelStartup.Instance); Logger.Log($"Running {VersionHelper.FullVersion}", LoggerLevelStartup.Instance);
// This loads the config, see ServerSettings.cs for more information // This loads the config, see ServerSettings.cs for more information
Logger.Log("Loaded config file version " + ServerSettings.Instance.ConfigVersion, LoggerLevelStartup.Instance); Logger.Log("Loaded config file version " + ServerSettings.Instance.ConfigVersion, LoggerLevelStartup.Instance);