Skip to content

Commit

Permalink
Embed version in ModCore
Browse files Browse the repository at this point in the history
  • Loading branch information
Naamloos committed Oct 25, 2023
1 parent 6e1ccfa commit 4b9ad04
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ jobs:
tags: |
ghcr.io/naamloos/modcore:latest
ghcr.io/naamloos/modcore:${{ steps.previoustag.outputs.tag }}
build-args: |
"BUILD_VER=${{ steps.previoustag.outputs.tag }}"
5 changes: 4 additions & 1 deletion ModCore/Commands/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.IO;
using Microsoft.Extensions.Caching.Memory;
using ModCore.AutoComplete;
using System.Reflection;

namespace ModCore.Commands
{
Expand Down Expand Up @@ -51,6 +52,7 @@ public async Task AboutAsync(InteractionContext ctx)
.AddField("Want to contribute?", "Contributions are always welcome at our [GitHub repo.](https://github.com/Naamloos/ModCore)")
.AddField("Donate?", "Currently, ModCore is hosted off my (Naamloos's) own money. Donations are always welcome over at [Ko-Fi](https://ko-fi.com/Naamloos)!")
.WithThumbnail(ctx.Client.CurrentUser.AvatarUrl)
.WithFooter($"ModCore version {Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyVersionAttribute>().Version}")
.Build();

await ctx.CreateResponseAsync(eb, true);
Expand Down Expand Up @@ -86,7 +88,8 @@ public async Task StatusAsync(InteractionContext ctx)
.AddField("⏱️ Socket Uptime", string.Format("<t:{0}:R>", StartTimes.SocketStartTime.ToUnixTimeSeconds()), true)
.AddField("💻 Operating System", osVersion.StartsWith("Unix")? fetchLinuxName() : Environment.OSVersion.VersionString, true)
.AddField("🪟 Framework", RuntimeInformation.FrameworkDescription, true)
.AddField("📖 DSharpPlus", ctx.Client.VersionString, true);
.AddField("📖 DSharpPlus", ctx.Client.VersionString, true)
.WithFooter($"ModCore version {Assembly.GetEntryAssembly().GetCustomAttribute<AssemblyVersionAttribute>().Version}");

await ctx.CreateResponseAsync(embed, true);
}
Expand Down
3 changes: 2 additions & 1 deletion dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# BUILD
FROM mcr.microsoft.com/dotnet/sdk:7.0-alpine AS build
ARG BUILD_VER
WORKDIR /src
COPY ./ModCore ./
RUN dotnet restore
RUN dotnet publish -c Release -o out
RUN dotnet publish -c Release -o out /p:VersionPrefix=${BUILD_VER}

# RUNNER IMAGE
FROM mcr.microsoft.com/dotnet/aspnet:7.0-alpine
Expand Down

0 comments on commit 4b9ad04

Please sign in to comment.