From 7dd303ce0dc14337f4741ef2b8930e7aad3e3ad8 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 2 May 2026 14:02:43 +0000 Subject: [PATCH] feat(web): show deployed commit SHA in landing footer Inject GITHUB_SHA (or local git rev-parse fallback) at build time via Vite's `define` and render it in the landing footer as a link to the GitHub commit. Lets you eyeball whether the production deploy is on the expected revision. https://claude.ai/code/session_01WGbZGB93xMgBpBmoUDk91w --- apps/web/src/components/landing/footer.tsx | 14 ++++++++++++-- apps/web/src/types/build-info.d.ts | 1 + apps/web/vite.config.ts | 14 ++++++++++++++ 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 apps/web/src/types/build-info.d.ts diff --git a/apps/web/src/components/landing/footer.tsx b/apps/web/src/components/landing/footer.tsx index a521b390..4c72f3fc 100644 --- a/apps/web/src/components/landing/footer.tsx +++ b/apps/web/src/components/landing/footer.tsx @@ -141,8 +141,18 @@ export function Footer() { © {new Date().getFullYear()} Stackpanel · MIT licensed · Built on Nix, devenv, Caddy, SOPS, and process-compose

-

- Not affiliated with NixOS, devenv, or Cloudflare. +

+ Not affiliated with NixOS, devenv, or Cloudflare. + · + + {__COMMIT_SHA__} +

diff --git a/apps/web/src/types/build-info.d.ts b/apps/web/src/types/build-info.d.ts new file mode 100644 index 00000000..7050391d --- /dev/null +++ b/apps/web/src/types/build-info.d.ts @@ -0,0 +1 @@ +declare const __COMMIT_SHA__: string; diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index 62f7dc12..62322c9f 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -2,6 +2,7 @@ import tailwindcss from "@tailwindcss/vite"; import { tanstackStart } from "@tanstack/react-start/plugin/vite"; import viteReact from "@vitejs/plugin-react"; // import alchemy from "alchemy/cloudflare/tanstack-start"; +import { execSync } from "node:child_process"; import type { Plugin } from "vite"; import { defineConfig } from "vite"; import tsconfigPaths from "vite-tsconfig-paths"; @@ -30,7 +31,20 @@ function patchImportMetaUrl(): Plugin { const docsProxyUrl = process.env.DOCS_PROXY_URL || "http://localhost:4000"; +const commitSha = (() => { + const fromCi = process.env.GITHUB_SHA; + if (fromCi) return fromCi.slice(0, 7); + try { + return execSync("git rev-parse --short HEAD", { encoding: "utf8" }).trim(); + } catch { + return "unknown"; + } +})(); + export default defineConfig({ + define: { + __COMMIT_SHA__: JSON.stringify(commitSha), + }, plugins: [ tsconfigPaths({ skip: (dir) => dir === ".worktrees" || dir === ".stack",