Add versioning to footer

This commit is contained in:
2026-02-01 22:37:53 +01:00
parent 5f05557682
commit 0d1dd3b0fe
3 changed files with 39 additions and 3 deletions

View File

@ -19,6 +19,12 @@ RUN bunx prisma generate
# Uncomment the following line in case you want to disable telemetry during the build. # Uncomment the following line in case you want to disable telemetry during the build.
ENV NEXT_TELEMETRY_DISABLED=1 ENV NEXT_TELEMETRY_DISABLED=1
ARG GIT_SHA=unknown
ARG APP_VERSION=0.0.0
ARG DEPLOY_ENV=production
ENV NEXT_PUBLIC_GIT_SHA=$GIT_SHA \
NEXT_PUBLIC_APP_VERSION=$APP_VERSION \
NEXT_PUBLIC_DEPLOY_ENV=$DEPLOY_ENV
ARG DATABASE_URL ARG DATABASE_URL
ENV DATABASE_URL=$DATABASE_URL ENV DATABASE_URL=$DATABASE_URL
@ -34,6 +40,12 @@ ENV NEXT_TELEMETRY_DISABLED=1
ENV NODE_ENV=production \ ENV NODE_ENV=production \
PORT=3000 \ PORT=3000 \
HOSTNAME="0.0.0.0" HOSTNAME="0.0.0.0"
ARG GIT_SHA=unknown
ARG APP_VERSION=0.0.0
ARG DEPLOY_ENV=production
ENV NEXT_PUBLIC_GIT_SHA=$GIT_SHA \
NEXT_PUBLIC_APP_VERSION=$APP_VERSION \
NEXT_PUBLIC_DEPLOY_ENV=$DEPLOY_ENV
RUN groupadd --system --gid 1001 nodejs && \ RUN groupadd --system --gid 1001 nodejs && \
useradd --system --uid 1001 --no-log-init -g nodejs nextjs useradd --system --uid 1001 --no-log-init -g nodejs nextjs

View File

@ -1,10 +1,12 @@
{ {
"name": "app.gaertan.art", "name": "app.gaertan.art",
"version": "0.1.0", "version": "1.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"dev:version": "NEXT_PUBLIC_GIT_SHA=$(git rev-parse --short HEAD) NEXT_PUBLIC_DEPLOY_ENV=dev bun dev",
"build": "next build", "build": "next build",
"build:version": "NEXT_PUBLIC_GIT_SHA=$(git rev-parse --short HEAD) NEXT_PUBLIC_DEPLOY_ENV=prod bun run build",
"start": "next start", "start": "next start",
"lint": "biome check", "lint": "biome check",
"format": "biome format --write" "format": "biome format --write"

View File

@ -1,5 +1,27 @@
import pkg from "../../../package.json";
const appVersion =
process.env.NEXT_PUBLIC_APP_VERSION ??
pkg.version;
const gitSha =
process.env.NEXT_PUBLIC_GIT_SHA ??
process.env.VERCEL_GIT_COMMIT_SHA ??
process.env.GIT_COMMIT_SHA ??
"";
const deployEnv =
process.env.NEXT_PUBLIC_DEPLOY_ENV ??
process.env.NODE_ENV ??
"unknown";
const versionLabel = gitSha
? `v${appVersion}+${gitSha.slice(0, 7)}`
: `v${appVersion}`;
const envLabel = deployEnv === "production" ? "prod" : deployEnv;
export default function Footer() { export default function Footer() {
return ( return (
<div>© 2026 by gaertan.art | All rights reserved</div> <div className="flex items-center justify-between text-xs text-muted-foreground">
<span>© 2026 by gaertan.art | All rights reserved</span>
<span>{versionLabel} · {envLabel}</span>
</div>
); );
} }