Implemented Versioning
Some checks failed
Build, Tag, Push Docker Image / build (push) Has been cancelled
Create Release / Generate Release (push) Has been cancelled

This commit is contained in:
Mia Rose Winter 2024-02-20 11:35:20 +01:00
parent 44c4398fe4
commit f5d2f70692
Signed by: miawinter
GPG key ID: 4B6F6A83178F595E
6 changed files with 34 additions and 5 deletions

View file

@ -22,8 +22,15 @@ jobs:
images: ${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=ref,event=tag
labels: |
maintainer=Mia Rose Winter
org.opencontainers.image.title=Wave
org.opencontainers.image.url=https://github.com/miawinter98/wave
org.opencontainers.image.source=https://github.com/miawinter98/wave
org.opencontainers.image.description=The Collaborative Open Source Blogging Engine
org.opencontainers.image.vendor=Winter Software
org.opencontainers.image.licenses=MIT
- name: Log into the Container registry
uses: docker/login-action@v3
@ -42,3 +49,5 @@ jobs:
file: Wave/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}

View file

@ -87,11 +87,14 @@
<div class="bg-base-200 p-4 h-full flex flex-col gap-4 w-48 lg:w-64">
<NavMenu />
<a class="absolute left-2 right-2 bottom-2 text-center text-slate-400" href="https://github.com/miawinter98/wave">@Version</a>
</div>
</div>
</div>
@code {
[CascadingParameter(Name = "Version")]
private string Version { get; set; } = string.Empty;
[CascadingParameter(Name = "UserTheme")]
private string? UserTheme { get; set; }
[CascadingParameter]

View file

@ -42,7 +42,7 @@
</Authorized>
</AuthorizeView>
</ul>
<ul class="menu gap-2" aria-label="Account">
<ul class="menu gap-2 mb-2" aria-label="Account">
<AuthorizeView>
<Authorized>
<li class="flex gap-2">

View file

@ -14,16 +14,26 @@ HEALTHCHECK --start-period=5s --start-interval=15s --interval=30s --timeout=30s
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
ARG VERSION=0.0.1
WORKDIR /src
COPY ["Wave/Wave.csproj", "Wave/"]
RUN dotnet restore "./Wave/Wave.csproj"
COPY . .
WORKDIR "/src/Wave"
RUN dotnet build "./Wave.csproj" -c $BUILD_CONFIGURATION -o /app/build
RUN dotnet build "./Wave.csproj" \
-c $BUILD_CONFIGURATION \
-o /app/build \
-p:Version="${VERSION}"
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./Wave.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
ARG VERSION=0.0.1
ARG VERSION_SUFFIX=
RUN dotnet publish "./Wave.csproj" \
-c $BUILD_CONFIGURATION \
-o /app/publish \
-p:UseAppHost=false \
-p:Version="${VERSION}"
FROM base AS final
WORKDIR /app

View file

@ -1,3 +1,4 @@
using System.Reflection;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Server;
using Microsoft.AspNetCore.DataProtection;
@ -18,6 +19,11 @@
using Wave.Services;
using Wave.Utilities;
string humanReadableVersion = Assembly.GetEntryAssembly()?
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
.InformationalVersion.Split("+", 2)[0] ?? "unknown";
Console.WriteLine(@"Starting Wave " + humanReadableVersion);
var logMessages = new List<string>();
var builder = WebApplication.CreateBuilder(args);
@ -28,6 +34,7 @@
.AddIniFile( Path.Combine(FileSystemService.ConfigurationDirectory, "config.ini"), true, false)
.AddXmlFile( Path.Combine(FileSystemService.ConfigurationDirectory, "config.xml"), true, false)
.AddEnvironmentVariables("WAVE_");
builder.Services.AddCascadingValue("Version", _ => humanReadableVersion);
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.Services.AddControllers(options => {

File diff suppressed because one or more lines are too long