Include git sha in binary

This commit is contained in:
runebaas 2018-05-06 03:24:09 +02:00
parent 7238e7177d
commit 59ee6b289a
No known key found for this signature in database
GPG key ID: 2677AF508D0300D6
6 changed files with 15 additions and 6 deletions

View file

@ -22,7 +22,7 @@ build:
script: script:
- dotnet restore - dotnet restore
- dotnet test Tests - dotnet test Tests
- dotnet publish --configuration Release -o Binaries ./ - dotnet publish --version-suffix ${CI_COMMIT_SHA:0:8} --configuration Release -o Binaries ./
deploy: deploy:
stage: deploy stage: deploy

View file

@ -37,7 +37,7 @@ namespace Geekbot.net.Commands.Utils
eb.WithAuthor(new EmbedAuthorBuilder() eb.WithAuthor(new EmbedAuthorBuilder()
.WithIconUrl(_client.CurrentUser.GetAvatarUrl()) .WithIconUrl(_client.CurrentUser.GetAvatarUrl())
.WithName($"{Constants.Name} V{Constants.BotVersion}")); .WithName($"{Constants.Name} V{Constants.BotVersion()}"));
var botOwner = await Context.Guild.GetUserAsync(ulong.Parse(_redis.StringGet("botOwner"))); var botOwner = await Context.Guild.GetUserAsync(ulong.Parse(_redis.StringGet("botOwner")));
var uptime = DateTime.Now.Subtract(Process.GetCurrentProcess().StartTime); var uptime = DateTime.Now.Subtract(Process.GetCurrentProcess().StartTime);

View file

@ -4,6 +4,8 @@
<TargetFramework>netcoreapp2.0</TargetFramework> <TargetFramework>netcoreapp2.0</TargetFramework>
<ApplicationIcon>derp.ico</ApplicationIcon> <ApplicationIcon>derp.ico</ApplicationIcon>
<Version>3.7.0</Version> <Version>3.7.0</Version>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
<Company>Pizza and Coffee Studios</Company> <Company>Pizza and Coffee Studios</Company>
<Authors>Pizza and Coffee Studios</Authors> <Authors>Pizza and Coffee Studios</Authors>
<Description>A Discord bot</Description> <Description>A Discord bot</Description>

View file

@ -1,9 +1,16 @@
namespace Geekbot.net.Lib using System.Reflection;
namespace Geekbot.net.Lib
{ {
public class Constants public class Constants
{ {
public const string Name = "Geekbot"; public const string Name = "Geekbot";
public const double BotVersion = 3.7;
public static string BotVersion()
{
return typeof(Program).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion;
}
public const double ApiVersion = 1; public const double ApiVersion = 1;
} }
} }

View file

@ -25,7 +25,7 @@ namespace Geekbot.net.Lib.ErrorHandling
var sentryDsn = Environment.GetEnvironmentVariable("SENTRY"); var sentryDsn = Environment.GetEnvironmentVariable("SENTRY");
if (!string.IsNullOrEmpty(sentryDsn)) if (!string.IsNullOrEmpty(sentryDsn))
{ {
_raven = new RavenClient(sentryDsn); _raven = new RavenClient(sentryDsn) { Release = Constants.BotVersion() };
_logger.Information(LogSource.Geekbot, $"Command Errors will be logged to Sentry: {sentryDsn}"); _logger.Information(LogSource.Geekbot, $"Command Errors will be logged to Sentry: {sentryDsn}");
} }
else else

View file

@ -11,7 +11,7 @@ namespace Geekbot.net.WebApi.Status
{ {
var responseBody = new ApiStatusDto var responseBody = new ApiStatusDto
{ {
GeekbotVersion = Constants.BotVersion.ToString(), GeekbotVersion = Constants.BotVersion(),
ApiVersion = Constants.ApiVersion.ToString(), ApiVersion = Constants.ApiVersion.ToString(),
Status = "Online" Status = "Online"
}; };