feat: show live build version in web UI
Build & Push Docker Image / build (push) Successful in 2m36s

- /api/version returns version, commitSha, buildDate, trashRetentionDays
- CI passes COMMIT_SHA (full), BUILD_DATE and VERSION (git tag) as
  docker build args; Dockerfile bakes them as env
- sidebar footer shows version/sha linked to the Gitea commit
- admin System tab shows version, commit link, build date, trash retention
This commit is contained in:
opencode
2026-08-02 02:13:27 +02:00
parent 2f20b1e5c2
commit 803802a5b6
11 changed files with 247 additions and 3 deletions
@@ -1,6 +1,7 @@
import { Link, useLocation } from "wouter";
import { LayoutDashboard, Wrench, PlusCircle, BarChart3, LogIn, LogOut, User, ShieldCheck, AlertTriangle, Trash2 } from "lucide-react";
import { useAuth } from "@/hooks/use-auth";
import { useGetVersion, getGetVersionQueryKey } from "@workspace/api-client-react";
import { Button } from "@/components/ui/button";
import { Skeleton } from "@/components/ui/skeleton";
import { ThemeToggle } from "@/components/theme-toggle";
@@ -8,6 +9,9 @@ import { ThemeToggle } from "@/components/theme-toggle";
export function Layout({ children }: { children: React.ReactNode }) {
const [location] = useLocation();
const { user, isLoading, isAuthenticated, isAdmin, isLocalMode, tier, hasFeature, login, logout } = useAuth();
const { data: version } = useGetVersion({
query: { queryKey: getGetVersionQueryKey(), staleTime: Infinity, retry: false },
});
const links = [
{ href: "/", label: "Dashboard", icon: LayoutDashboard },
@@ -95,6 +99,24 @@ export function Layout({ children }: { children: React.ReactNode }) {
</Button>
)}
</div>
<div className="px-4 py-2.5 border-t flex items-center justify-between text-[11px] text-muted-foreground">
<span className="font-medium">toolr</span>
{version?.commitSha ? (
<a
href={`https://git.kubebase.de/admin/tool-evaluator/commit/${version.commitSha}`}
target="_blank"
rel="noreferrer"
className="font-mono hover:underline"
title={version.commitSha}
>
{version.version && version.version !== "dev"
? version.version
: `sha-${version.commitSha.slice(0, 7)}`}
</a>
) : version?.version && version.version !== "dev" ? (
<span className="font-mono">{version.version}</span>
) : null}
</div>
</aside>
<main className="flex-1 flex flex-col min-w-0">