diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3928542..98eb9ba 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/Geekbot.net/Commands/Utils/Info.cs b/Geekbot.net/Commands/Utils/Info.cs index 446abfe..de34e89 100644 --- a/Geekbot.net/Commands/Utils/Info.cs +++ b/Geekbot.net/Commands/Utils/Info.cs @@ -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); diff --git a/Geekbot.net/Geekbot.net.csproj b/Geekbot.net/Geekbot.net.csproj index 861085b..90ff896 100755 --- a/Geekbot.net/Geekbot.net.csproj +++ b/Geekbot.net/Geekbot.net.csproj @@ -4,6 +4,8 @@ netcoreapp2.0 derp.ico 3.7.0 + $(VersionSuffix) + $(Version)-$(VersionSuffix) Pizza and Coffee Studios Pizza and Coffee Studios A Discord bot diff --git a/Geekbot.net/Lib/Constants.cs b/Geekbot.net/Lib/Constants.cs index dbba570..240cfce 100644 --- a/Geekbot.net/Lib/Constants.cs +++ b/Geekbot.net/Lib/Constants.cs @@ -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().InformationalVersion; + } + public const double ApiVersion = 1; } } \ No newline at end of file diff --git a/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs b/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs index 382bdda..99d1e8b 100644 --- a/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs +++ b/Geekbot.net/Lib/ErrorHandling/ErrorHandler.cs @@ -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 diff --git a/Geekbot.net/WebApi/Status/StatusController.cs b/Geekbot.net/WebApi/Status/StatusController.cs index 5f995c9..05196a2 100644 --- a/Geekbot.net/WebApi/Status/StatusController.cs +++ b/Geekbot.net/WebApi/Status/StatusController.cs @@ -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" };