From a1b8f8d064fecba6b87c24a5cdff46434ae49077 Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Fri, 12 Feb 2021 16:26:05 -0600 Subject: [PATCH] add version information (#15) --- .github/workflows/release.yml | 4 ++-- Directory.Build.props | 5 +++++ Dockerfile | 3 ++- ErsatzTV/Shared/MainLayout.razor | 12 ++++++++++-- docker-compose.yml | 2 ++ 5 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 Directory.Build.props diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 640a892f8..b6759ffcb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,8 +42,8 @@ jobs: release_name_cli="ErsatzTV.CommandLine-$tag-${{ matrix.target }}" # Build everything - dotnet publish ErsatzTV/ErsatzTV.csproj --framework net5.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name" - dotnet publish ErsatzTV.CommandLine/ErsatzTV.CommandLine.csproj --framework net5.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name_cli" + dotnet publish ErsatzTV/ErsatzTV.csproj --framework net5.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name" /p:InformationalVersion="${tag:1}-${{ matrix.target }}" + dotnet publish ErsatzTV.CommandLine/ErsatzTV.CommandLine.csproj --framework net5.0 --runtime "${{ matrix.target }}" -c Release -o "$release_name_cli" /p:InformationalVersion="${tag:1}-${{ matrix.target }}" # Pack files if [ "${{ matrix.target }}" == "win-x64" ]; then diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 000000000..c4d1aa6eb --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,5 @@ + + + develop + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index fd5e6414e..db895e8c0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,8 @@ COPY ErsatzTV.Core/. ./ErsatzTV.Core/ COPY ErsatzTV.Core.Tests/. ./ErsatzTV.Core.Tests/ COPY ErsatzTV.Infrastructure/. ./ErsatzTV.Infrastructure/ WORKDIR /source/ErsatzTV -RUN dotnet publish -c release -o /app -r linux-x64 --self-contained false --no-restore +ARG INFO_VERSION="unknown" +RUN dotnet publish -c release -o /app -r linux-x64 --self-contained false --no-restore /p:InformationalVersion=${INFO_VERSION} # final stage/image FROM runtime-base diff --git a/ErsatzTV/Shared/MainLayout.razor b/ErsatzTV/Shared/MainLayout.razor index 6182a5555..efac1ed82 100644 --- a/ErsatzTV/Shared/MainLayout.razor +++ b/ErsatzTV/Shared/MainLayout.razor @@ -1,4 +1,5 @@ -@inherits LayoutComponentBase +@using System.Reflection +@inherits LayoutComponentBase @@ -33,6 +34,11 @@ Schedules Playouts Logs + + + ErsatzTV Version + @InfoVersion + @@ -43,7 +49,9 @@ @code { - bool _drawerOpen = true; + private static readonly string InfoVersion = Assembly.GetEntryAssembly().GetCustomAttribute()?.InformationalVersion ?? "unknown"; + + private bool _drawerOpen = true; private void DrawerToggle() => _drawerOpen = !_drawerOpen; diff --git a/docker-compose.yml b/docker-compose.yml index b9b5eec39..7340deb27 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: ersatztv: build: context: . + args: + INFO_VERSION: "docker-compose-develop" ports: - "8409:8409" volumes: