Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

✨ Show version number in app (#601)

Mark Pitblado4c3d5bf84618
diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml
index ae173a2bf..33bec9ced 100644
--- a/.github/workflows/docker-image.yml
+++ b/.github/workflows/docker-image.yml
@@ -37,3 +37,5 @@ jobs:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
+ build-args: |
+ APP_VERSION=${{ github.ref }}
diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile
index 3c4e1769e..095f16a3a 100644
--- a/apps/web/Dockerfile
+++ b/apps/web/Dockerfile
@@ -17,6 +17,10 @@ RUN yarn --network-timeout 1000000
COPY --from=builder /app/out/full/ .
COPY turbo.json turbo.json
RUN yarn db:generate
+
+ARG APP_VERSION
+ENV NEXT_PUBLIC_APP_VERSION=$APP_VERSION
+
RUN yarn build
FROM node:16 AS runner
diff --git a/apps/web/declarations/environment.d.ts b/apps/web/declarations/environment.d.ts
index b87872505..a16d7de81 100644
--- a/apps/web/declarations/environment.d.ts
+++ b/apps/web/declarations/environment.d.ts
@@ -88,6 +88,10 @@ declare global {
* AWS region
*/
AWS_REGION?: string;
+ /**
+ * The app version just for reference
+ */
+ NEXT_PUBLIC_APP_VERSION?: string;
}
}
}
diff --git a/apps/web/src/components/layouts/standard-layout.tsx b/apps/web/src/components/layouts/standard-layout.tsx
index d387d6c9a..91bf70129 100644
--- a/apps/web/src/components/layouts/standard-layout.tsx
+++ b/apps/web/src/components/layouts/standard-layout.tsx
@@ -1,5 +1,6 @@
import { domMax, LazyMotion } from "framer-motion";
import dynamic from "next/dynamic";
+import Link from "next/link";
import React from "react";
import { DayjsProvider } from "@/utils/dayjs";
@@ -11,6 +12,23 @@ import { MobileNavigation } from "./standard-layout/mobile-navigation";
const Feedback = dynamic(() => import("../feedback"), { ssr: false });
+const appVersion = process.env.NEXT_PUBLIC_APP_VERSION
+ ? `v${process.env.NEXT_PUBLIC_APP_VERSION}`
+ : null;
+
+const AppVersion = () => {
+ if (!appVersion) return null;
+
+ return (
+ <Link
+ href="https://github.com/lukevella/rallly/releases"
+ className="fixed bottom-0 left-0 hidden rounded-none rounded-tr px-2 py-1 text-xs text-slate-400 lg:block"
+ >
+ {appVersion}
+ </Link>
+ );
+};
+
const StandardLayout: React.FunctionComponent<{
children?: React.ReactNode;
}> = ({ children, ...rest }) => {
@@ -23,6 +41,7 @@ const StandardLayout: React.FunctionComponent<{
{process.env.NEXT_PUBLIC_FEEDBACK_EMAIL ? <Feedback /> : null}
<MobileNavigation />
<div className="mx-auto max-w-4xl grow">{children}</div>
+ <AppVersion />
</div>
</ModalProvider>
</DayjsProvider>
diff --git a/scripts/vercel.sh b/scripts/vercel.sh
new file mode 100755
index 000000000..3e60f362d
--- /dev/null
+++ b/scripts/vercel.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+export NEXT_PUBLIC_APP_VERSION=$(node -p "require('./package.json').version")
+echo "Set NEXT_PUBLIC_APP_VERSION=$NEXT_PUBLIC_APP_VERSION"
+yarn build
+# Deploy migration using direct database connection (no connection pool)
+DATABASE_URL=$DIRECT_DATABASE_URL yarn db:deploy
diff --git a/turbo.json b/turbo.json
index 2754a79a5..c8ceacb22 100644
--- a/turbo.json
+++ b/turbo.json
@@ -16,6 +16,7 @@
"DISABLE_LANDING_PAGE",
"EMAIL_PROVIDER",
"MAINTENANCE_MODE",
+ "NEXT_PUBLIC_APP_VERSION",
"NEXT_PUBLIC_BASE_URL",
"NEXT_PUBLIC_BETA",
"NEXT_PUBLIC_CRISP_WEBSITE_ID",
diff --git a/vercel.json b/vercel.json
index ccdfbfcf8..67e606d7e 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,4 +1,4 @@
{
- "buildCommand": "yarn build && DATABASE_URL=$DIRECT_DATABASE_URL yarn db:deploy",
+ "buildCommand": "./scripts/vercel.sh",
"outputDirectory": "./apps/web/.next"
}