Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
FROM oven/bun:1 AS builder

ARG VERSION
ARG COMMIT

WORKDIR /app
COPY . .

ENV APP_VERSION=${VERSION} \
APP_COMMIT=${COMMIT}

RUN bun install --frozen-lockfile && \
bun run build

Expand Down
29 changes: 26 additions & 3 deletions src/components/layout/AppFooter.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<script setup lang="ts">
import { useVersion } from "@/composables/useHealth"
import {
appVersion,
commitSha,
commitUrl,
isStableBuild,
releaseUrl,
shortCommitSha,
} from "@/lib/buildInfo"

const appVersion = __APP_VERSION__
const { data: versionData } = useVersion()
</script>

Expand All @@ -12,13 +19,29 @@ const { data: versionData } = useVersion()
>
<div class="flex items-center gap-2">
<a
:href="`https://github.com/licenseware/ory-admin-ui/releases/tag/v${appVersion}`"
v-if="isStableBuild"
:href="releaseUrl"
target="_blank"
rel="noopener noreferrer"
class="hover:text-text-secondary transition-colors"
>
Ory Admin UI v{{ appVersion }}
Ory Admin UI {{ appVersion }}
</a>
<span v-else>
Ory Admin UI {{ appVersion }}
<template v-if="shortCommitSha">
&middot;
<a
:href="commitUrl"
:title="commitSha"
target="_blank"
rel="noopener noreferrer"
class="hover:text-text-secondary font-mono transition-colors"
>
{{ shortCommitSha }}
</a>
</template>
</span>
<span v-if="versionData?.version" class="text-text-muted">
&middot;
<a
Expand Down
17 changes: 17 additions & 0 deletions src/lib/buildInfo.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const REPO = "licenseware/ory-admin-ui"

const rawVersion = __APP_VERSION__
const rawCommit = __APP_COMMIT__

export const isStableBuild = /^\d+\.\d+\.\d+$/.test(rawVersion)

export const commitSha = rawCommit
export const shortCommitSha = rawCommit.slice(0, 7)

export const appVersion = isStableBuild ? `v${rawVersion}` : "edge"

export const repoUrl = `https://github.com/${REPO}`

export const releaseUrl = `${repoUrl}/releases/tag/v${rawVersion}`

export const commitUrl = `${repoUrl}/commit/${rawCommit}`
20 changes: 17 additions & 3 deletions src/views/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ import { useProfileStore, nameToSlug } from "@/stores/profile"
import { useThemeStore } from "@/stores/theme"
import { useHealthAlive, usePublicHealthAlive, useVersion } from "@/composables/useHealth"
import { useOathkeeperHealth, useOathkeeperVersion } from "@/composables/useOathkeeper"
import {
appVersion,
commitSha,
commitUrl,
isStableBuild,
releaseUrl,
shortCommitSha,
} from "@/lib/buildInfo"
import Card from "@/components/ui/Card.vue"
import CardHeader from "@/components/ui/CardHeader.vue"
import CardTitle from "@/components/ui/CardTitle.vue"
Expand Down Expand Up @@ -34,7 +42,12 @@ import {
} from "@lucide/vue"
import { toast } from "vue-sonner"

const appVersion = __APP_VERSION__
const buildLabel = isStableBuild
? appVersion
: shortCommitSha
? `${appVersion} · ${shortCommitSha}`
: appVersion
const buildUrl = isStableBuild ? releaseUrl : commitUrl
const profileStore = useProfileStore()
const themeStore = useThemeStore()

Expand Down Expand Up @@ -638,12 +651,13 @@ watch(theme, (newTheme) => {
<div class="border-border-subtle flex justify-between border-b py-2">
<span class="text-text-muted text-sm">Admin UI Version</span>
<a
:href="`https://github.com/licenseware/ory-admin-ui/releases/tag/v${appVersion}`"
:href="buildUrl"
:title="isStableBuild ? undefined : commitSha"
target="_blank"
rel="noopener noreferrer"
class="text-accent hover:text-accent-hover font-mono text-sm"
>
{{ appVersion }}
{{ buildLabel }}
</a>
</div>
<div class="border-border-subtle flex justify-between border-b py-2">
Expand Down
1 change: 1 addition & 0 deletions src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference types="vite/client" />

declare const __APP_VERSION__: string
declare const __APP_COMMIT__: string

declare module "*.vue" {
import type { DefineComponent } from "vue"
Expand Down
3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "")
return {
define: {
__APP_VERSION__: JSON.stringify(version),
__APP_VERSION__: JSON.stringify(env.APP_VERSION || version),
__APP_COMMIT__: JSON.stringify(env.APP_COMMIT || ""),
},
plugins: [
vue(),
Expand Down