web: verze API na jednom místě a číslo verze v patičce
This commit is contained in:
1 parent
946ff5ce12
commit
5d8b71c435
11 files changed
+102
-18
No files matched your search
@@ -0,0 +1,24 @@
|
||||
using System.Reflection;
|
||||
|
||||
namespace Helpdesk.Web.Infrastructure;
|
||||
|
||||
/// <summary>
|
||||
/// Verze běžící webové aplikace z <c><Version></c> v projektu. SDK k ní při sestavení
|
||||
/// v Gitu přidá hash commitu (<c>0.2.0+6e742b4…</c>); zobrazujeme jeho prvních 7 znaků,
|
||||
/// aby při ladění bylo jasné, který commit běží.
|
||||
/// </summary>
|
||||
public static class AppVersion
|
||||
{
|
||||
public static string Display { get; } = Format(
|
||||
typeof(AppVersion).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion);
|
||||
|
||||
internal static string Format(string? informationalVersion)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(informationalVersion))
|
||||
return "neznámá";
|
||||
|
||||
var parts = informationalVersion.Split('+', 2);
|
||||
var commit = parts.Length == 2 ? parts[1].Split('.')[0] : null;
|
||||
return string.IsNullOrEmpty(commit) ? parts[0] : $"{parts[0]} ({commit[..Math.Min(7, commit.Length)]})";
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user