Skip to content

Commit 231d8e6

Browse files
authored
Merge pull request #39 from TraGicCode/GH-38-version-not-being-set-correctly
(GH-38) Fix --version/-v to contain actual cli version
2 parents 33f2763 + 13d6738 commit 231d8e6

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

.github/workflows/docker_build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ jobs:
4747
with:
4848
context: .
4949
file: ./src/BuslyCLI.Console/Dockerfile
50+
build-args: |
51+
APP_VERSION=${{ inputs.version }}
5052
push: true
5153
tags: ${{ steps.meta.outputs.tags }}
5254
labels: ${{ steps.meta.outputs.labels }}

build.cake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ Task("Compile")
2727
.IsDependentOn("Clean")
2828
.Does(() =>
2929
{
30+
var msBuildSettings = new DotNetMSBuildSettings()
31+
.WithProperty("InformationalVersion", version);
3032
DotNetBuild(solution, new DotNetBuildSettings
3133
{
3234
Configuration = configuration,
35+
MSBuildSettings = msBuildSettings,
3336
});
3437
});
3538

src/BuslyCLI.Console/BuslyCLI.Console.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
<PackageIcon>busly-logo-128x128.png</PackageIcon>
1515
<RepositoryUrl>https://github.com/TraGicCode/busly-cli</RepositoryUrl>
1616
<RepositoryType>git</RepositoryType>
17+
<InformationalVersion>0.1.0</InformationalVersion>
18+
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
1719
</PropertyGroup>
1820

1921
<ItemGroup>

src/BuslyCLI.Console/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Use .NET 9 SDK to build
22
FROM mcr.microsoft.com/dotnet/sdk:10.0.100 AS build
3+
4+
ARG APP_VERSION=0.1.0
35
WORKDIR /src
46

57
COPY Directory.Build.props ./
@@ -21,7 +23,8 @@ RUN dotnet publish "./BuslyCLI.Console/BuslyCLI.Console.csproj" \
2123
-p:PublishTrimmed=true \
2224
-p:TrimMode=partial \
2325
-p:EnableCompressionInSingleFile=true \
24-
-p:SelfContained=true
26+
-p:SelfContained=true \
27+
-p:InformationalVersion=$APP_VERSION
2528

2629
# Use minimal runtime for smaller image size
2730
FROM mcr.microsoft.com/dotnet/runtime-deps:10.0-alpine AS final

src/BuslyCLI.Console/Spectre/AppConfiguration.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System.Reflection;
12
using BuslyCLI.Commands.Command;
23
using BuslyCLI.Commands.Demo;
34
using BuslyCLI.Commands.Event;
@@ -14,7 +15,8 @@ public static Action<IConfigurator> GetSpectreCommandConfiguration()
1415
{
1516
config.SetApplicationName("busly");
1617
// TODO: Allow this to get set via the CLI version
17-
config.SetApplicationVersion("1.0.0");
18+
var assembly = Assembly.GetExecutingAssembly().GetCustomAttribute<AssemblyInformationalVersionAttribute>();
19+
config.SetApplicationVersion(assembly.InformationalVersion);
1820
config.AddBranch("transport", transport =>
1921
{
2022
transport.SetDescription("Manage transport configurations.");

0 commit comments

Comments
 (0)