File tree Expand file tree Collapse file tree 5 files changed +46
-0
lines changed
Expand file tree Collapse file tree 5 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 6565 docker build \
6666 -f "$DOCKER_FILE" \
6767 --progress=plain \
68+ --build-arg APP_VERSION="$APP_VERSION" \
69+ --build-arg GIT_SHA="$GIT_SHA" \
6870 -t "usesend/$APP-$BUILD_PLATFORM:latest" \
6971 -t "usesend/$APP-$BUILD_PLATFORM:$GIT_SHA" \
7072 -t "usesend/$APP-$BUILD_PLATFORM:$APP_VERSION" \
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ import {
5151 DropdownMenuTrigger ,
5252} from "@usesend/ui/src/dropdown-menu" ;
5353import { FeedbackDialog } from "./FeedbackDialog" ;
54+ import { env } from "~/env" ;
5455
5556// General items
5657const generalItems = [
@@ -257,6 +258,7 @@ export function AppSidebar() {
257258 </ SidebarMenuItem >
258259 </ SidebarMenu >
259260 </ SidebarGroupContent >
261+ { isSelfHosted ( ) && < VersionInfo /> }
260262 < NavUser
261263 user = { {
262264 name :
@@ -371,3 +373,33 @@ export function NavUser({
371373 </ SidebarMenu >
372374 ) ;
373375}
376+
377+ function VersionInfo ( ) {
378+ const appVersion = env . NEXT_PUBLIC_APP_VERSION ;
379+ const gitSha = env . NEXT_PUBLIC_GIT_SHA ;
380+
381+ // If no version info available, don't render anything
382+ if ( ! appVersion && ! gitSha ) {
383+ return null ;
384+ }
385+
386+ const displayVersion =
387+ appVersion && appVersion !== "unknown"
388+ ? appVersion
389+ : gitSha && gitSha !== "unknown"
390+ ? gitSha . substring ( 0 , 7 )
391+ : null ;
392+
393+ if ( ! displayVersion ) {
394+ return null ;
395+ }
396+
397+ return (
398+ < div className = "px-2 py-2 text-xs text-muted-foreground" >
399+ < div className = "flex items-center justify-between" >
400+ < span > Version</ span >
401+ < span className = "font-mono" > { displayVersion } </ span >
402+ </ div >
403+ </ div >
404+ ) ;
405+ }
Original file line number Diff line number Diff line change @@ -83,6 +83,8 @@ export const env = createEnv({
8383 . string ( )
8484 . default ( "false" )
8585 . transform ( ( str ) => str === "true" ) ,
86+ NEXT_PUBLIC_APP_VERSION : z . string ( ) . optional ( ) ,
87+ NEXT_PUBLIC_GIT_SHA : z . string ( ) . optional ( ) ,
8688 } ,
8789
8890 /**
@@ -108,6 +110,8 @@ export const env = createEnv({
108110 API_RATE_LIMIT : process . env . API_RATE_LIMIT ,
109111 AUTH_EMAIL_RATE_LIMIT : process . env . AUTH_EMAIL_RATE_LIMIT ,
110112 NEXT_PUBLIC_IS_CLOUD : process . env . NEXT_PUBLIC_IS_CLOUD ,
113+ NEXT_PUBLIC_APP_VERSION : process . env . NEXT_PUBLIC_APP_VERSION ,
114+ NEXT_PUBLIC_GIT_SHA : process . env . NEXT_PUBLIC_GIT_SHA ,
111115 ADMIN_EMAIL : process . env . ADMIN_EMAIL ,
112116 FOUNDER_EMAIL : process . env . FOUNDER_EMAIL ,
113117 DISCORD_WEBHOOK_URL : process . env . DISCORD_WEBHOOK_URL ,
Original file line number Diff line number Diff line change @@ -46,7 +46,13 @@ RUN pnpm turbo run build --filter=web...
4646FROM base AS runner
4747WORKDIR /app
4848
49+ # Build arguments for version information
50+ ARG APP_VERSION=unknown
51+ ARG GIT_SHA=unknown
4952
53+ # Set version as environment variables
54+ ENV NEXT_PUBLIC_APP_VERSION=$APP_VERSION
55+ ENV NEXT_PUBLIC_GIT_SHA=$GIT_SHA
5056
5157COPY --from=installer /app/apps/web/next.config.js .
5258COPY --from=installer /app/apps/web/package.json .
Original file line number Diff line number Diff line change @@ -17,6 +17,8 @@ echo "Git SHA: $GIT_SHA"
1717
1818docker build -f " $SCRIPT_DIR /Dockerfile" \
1919 --progress=plain \
20+ --build-arg APP_VERSION=" $APP_VERSION " \
21+ --build-arg GIT_SHA=" $GIT_SHA " \
2022 -t " unsend/unsend:latest" \
2123 -t " unsend/unsend:$GIT_SHA " \
2224 -t " unsend/unsend:$APP_VERSION " \
You can’t perform that action at this time.
0 commit comments