From 5eebea314e6c475e012d0378aa4d6147485210f4 Mon Sep 17 00:00:00 2001 From: whoswhip Date: Tue, 17 Feb 2026 20:40:44 -0500 Subject: [PATCH] feat: add GIT_COMMIT_HASH support for versioning in Dockerfile and footer --- SharpbinV3.Client/Dockerfile | 2 ++ SharpbinV3.Client/src/app.d.ts | 1 + SharpbinV3.Client/src/lib/components/Footer.svelte | 9 +++++++++ SharpbinV3.Client/vite.config.ts | 3 ++- 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/SharpbinV3.Client/Dockerfile b/SharpbinV3.Client/Dockerfile index c1d8241..aa29f85 100644 --- a/SharpbinV3.Client/Dockerfile +++ b/SharpbinV3.Client/Dockerfile @@ -1,5 +1,7 @@ # syntax=docker/dockerfile:1 FROM node:20-alpine as build +ARG GIT_COMMIT_HASH +ENV GIT_COMMIT_HASH=${GIT_COMMIT_HASH} WORKDIR /app COPY package.json package-lock.json ./ RUN npm ci diff --git a/SharpbinV3.Client/src/app.d.ts b/SharpbinV3.Client/src/app.d.ts index e0ca175..af7db7c 100644 --- a/SharpbinV3.Client/src/app.d.ts +++ b/SharpbinV3.Client/src/app.d.ts @@ -27,6 +27,7 @@ declare global { | undefined; var turnstileLoaded: (() => void) | undefined; declare const __APP_VERSION__: string; + declare const COMMIT_HASH: string; } export {}; diff --git a/SharpbinV3.Client/src/lib/components/Footer.svelte b/SharpbinV3.Client/src/lib/components/Footer.svelte index f76118b..0cfb382 100644 --- a/SharpbinV3.Client/src/lib/components/Footer.svelte +++ b/SharpbinV3.Client/src/lib/components/Footer.svelte @@ -19,4 +19,13 @@ > • v{__APP_VERSION__} + {(COMMIT_HASH?.length ?? 0) >= 7 && COMMIT_HASH !== 'unknown' + ? `(${COMMIT_HASH.slice(0, 7)})` + : ''} diff --git a/SharpbinV3.Client/vite.config.ts b/SharpbinV3.Client/vite.config.ts index 20fd27a..05caf61 100644 --- a/SharpbinV3.Client/vite.config.ts +++ b/SharpbinV3.Client/vite.config.ts @@ -16,7 +16,8 @@ const allowedHosts = process.env.VITE_ALLOWED_HOSTS export default defineConfig({ plugins: [tailwindcss(), sveltekit()], define: { - __APP_VERSION__: JSON.stringify(pkg.version) + __APP_VERSION__: JSON.stringify(pkg.version), + COMMIT_HASH: JSON.stringify(process.env.GIT_COMMIT_HASH || 'unknown') }, server: { host: true,