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:
- dotnet restore
- dotnet test Tests
- dotnet publish --configuration Release -o Binaries ./
- dotnet publish --version-suffix ${CI_COMMIT_SHA:0:8} --configuration Release -o Binaries ./
deploy:
stage: deploy

View file

@ -37,7 +37,7 @@ namespace Geekbot.net.Commands.Utils
eb.WithAuthor(new EmbedAuthorBuilder()
.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 uptime = DateTime.Now.Subtract(Process.GetCurrentProcess().StartTime);

View file

@ -4,6 +4,8 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<ApplicationIcon>derp.ico</ApplicationIcon>
<Version>3.7.0</Version>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
<Company>Pizza and Coffee Studios</Company>
<Authors>Pizza and Coffee Studios</Authors>
<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 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;
}
}

View file

@ -25,7 +25,7 @@ namespace Geekbot.net.Lib.ErrorHandling
var sentryDsn = Environment.GetEnvironmentVariable("SENTRY");
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}");
}
else

View file

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