From 811b0b9b903e92a1ce4a71eb59d13a8f1e9d2c8c Mon Sep 17 00:00:00 2001 From: Andreas Molnar Date: Wed, 12 Aug 2026 12:33:38 +0200 Subject: [PATCH] update aio preview workflow to add version for builds --- .github/workflows/aio-preview.yml | 14 +++++++++++++- .github/workflows/release.yml | 12 +++++++++++- Dockerfile | 1 + VERSION | 1 + apps/backend/src/lib/config.ts | 6 +++++- apps/web/src/lib/config.ts | 2 +- apps/web/src/vite-env.d.ts | 3 ++- apps/web/vite.config.ts | 10 ++++++++++ 8 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 VERSION diff --git a/.github/workflows/aio-preview.yml b/.github/workflows/aio-preview.yml index 17b4963e..f2ae9ecb 100644 --- a/.github/workflows/aio-preview.yml +++ b/.github/workflows/aio-preview.yml @@ -13,6 +13,16 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + - name: Read application version + id: version + run: | + VERSION="$(tr -d '[:space:]' < VERSION)" + if [ -z "$VERSION" ]; then + echo "VERSION file is empty" >&2 + exit 1 + fi + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + - name: Set up Bun uses: oven-sh/setup-bun@v1 @@ -41,4 +51,6 @@ jobs: file: ./Dockerfile push: true platforms: linux/amd64,linux/arm64 - tags: ${{ secrets.DOCKER_USERNAME }}/dashwise:aio-preview + tags: | + ${{ secrets.DOCKER_USERNAME }}/dashwise:aio-preview + ${{ secrets.DOCKER_USERNAME }}/dashwise:${{ steps.version.outputs.version }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6b07d3b7..edfc504e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,16 @@ jobs: - name: Checkout code uses: actions/checkout@v3 + - name: Read application version + id: version + run: | + VERSION="$(tr -d '[:space:]' < VERSION)" + if [ -z "$VERSION" ]; then + echo "VERSION file is empty" >&2 + exit 1 + fi + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -33,7 +43,7 @@ jobs: push: true platforms: linux/amd64,linux/arm64 tags: | - ${{ secrets.DOCKER_USERNAME }}/dashwise:${{ secrets.VERSION }} + ${{ secrets.DOCKER_USERNAME }}/dashwise:${{ steps.version.outputs.version }} ${{ secrets.DOCKER_USERNAME }}/dashwise:latest ${{ secrets.DOCKER_USERNAME }}/dashwise:stable diff --git a/Dockerfile b/Dockerfile index 7bfe10f3..bb226484 100644 --- a/Dockerfile +++ b/Dockerfile @@ -72,6 +72,7 @@ COPY --from=build /app/packages/api-types/package.json /app/packages/api-types/p COPY --from=build /app/packages/types/package.json /app/packages/types/package.json COPY --from=build /app/pocketbase/migrations /app/pocketbase/migrations COPY --from=build /app/packages /app/packages +COPY --from=build /app/VERSION /app/VERSION RUN bun install --production --frozen-lockfile diff --git a/VERSION b/VERSION new file mode 100644 index 00000000..b66d68da --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +v1.0-rc1 diff --git a/apps/backend/src/lib/config.ts b/apps/backend/src/lib/config.ts index b804a2ca..fc0fa4b6 100644 --- a/apps/backend/src/lib/config.ts +++ b/apps/backend/src/lib/config.ts @@ -1,5 +1,9 @@ +import { readFileSync } from "node:fs"; + const env = Bun.env; +const dashwiseVersion = readFileSync(new URL("../../../../VERSION", import.meta.url), "utf8").trim(); + const processAllowSsl = env.ALLOW_SSL; const processEnvironment = env.ENVIRONMENT; const processStartPocketBase = env.START_POCKETBASE; @@ -67,7 +71,7 @@ export const config = { PB_ADMIN_PASSWORD: env.PB_ADMIN_PASSWORD, DASHWISE_URL: env.DASHWISE_URL || (processEnvironment === "dev" ? "http://localhost:3000" : ""), APP_BASE_URL: getEnv("APP_BASE_URL", "NEXT_PUBLIC_APP_URL") || env.DASHWISE_URL || (processEnvironment === "dev" ? "http://localhost:3000" : ""), - DASHWISE_VERSION: 'v1.0-alpha1', + DASHWISE_VERSION: dashwiseVersion || "development", GITHUB_REPO: 'andreasmolnardev/dashwise-next', INSTANCE_NAME: getEnv("INSTANCE_NAME", "NEXT_PUBLIC_INSTANCE_NAME") || "Dashwise", DISABLE_USER_SIGNUP: truthyEnv(getEnv("DISABLE_USER_SIGNUP", "NEXT_PUBLIC_DISABLE_USER_SIGNUP")), diff --git a/apps/web/src/lib/config.ts b/apps/web/src/lib/config.ts index 5da443a3..6e6d8842 100644 --- a/apps/web/src/lib/config.ts +++ b/apps/web/src/lib/config.ts @@ -54,7 +54,7 @@ const config: Config = { default_bg_url: env.NEXT_PUBLIC_DEFAULT_BG_URL || "/dashboard-wallpaper.png", - version: "v1.0-alpha2", + version: env.NEXT_PUBLIC_VERSION || "development", allowInsecureCertsForIntegrationUrls: allowInsecureCertsForIntegrationUrls || false, enableSSO: enableSSOLogin, diff --git a/apps/web/src/vite-env.d.ts b/apps/web/src/vite-env.d.ts index 75a71fe5..e71e3a66 100644 --- a/apps/web/src/vite-env.d.ts +++ b/apps/web/src/vite-env.d.ts @@ -6,10 +6,11 @@ interface ImportMetaEnv { readonly NEXT_PUBLIC_PB_URL?: string; readonly NEXT_PUBLIC_JOBS_URL?: string; readonly NEXT_PUBLIC_DEFAULT_BG_URL?: string; + readonly NEXT_PUBLIC_VERSION?: string; readonly NEXT_PUBLIC_INTEGRATIONS_ENABLE_SSL?: string; readonly NEXT_PUBLIC_ENABLE_SSO?: string; readonly NEXT_PUBLIC_DISABLE_USER_SIGNUP?: string; readonly NEXT_PUBLIC_JOBS_WEBHOOK_ENABLE?: string; readonly PB_ADMIN_EMAIL?: string; readonly PB_ADMIN_PASSWORD?: string; -} \ No newline at end of file +} diff --git a/apps/web/vite.config.ts b/apps/web/vite.config.ts index 22251666..dda31db9 100644 --- a/apps/web/vite.config.ts +++ b/apps/web/vite.config.ts @@ -1,9 +1,19 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react-swc"; +import { readFileSync } from "node:fs"; import path from "path"; +const version = readFileSync(path.resolve(__dirname, "../../VERSION"), "utf8").trim(); + +if (!version) { + throw new Error("VERSION file is empty"); +} + export default defineConfig({ envPrefix: ["VITE_", "NEXT_PUBLIC_"], + define: { + "import.meta.env.NEXT_PUBLIC_VERSION": JSON.stringify(version), + }, plugins: [react()], resolve: { alias: {