diff --git a/.github/workflows/deploy-containers.yaml b/.github/workflows/deploy-containers.yaml index 5f954a212..19dfdcb42 100644 --- a/.github/workflows/deploy-containers.yaml +++ b/.github/workflows/deploy-containers.yaml @@ -57,11 +57,17 @@ jobs: digest: ${{ steps.build.outputs.digest }} steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Compute image prefix id: meta run: echo "prefix=${REGISTRY}/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT" + - name: Compute dashboard version + id: dashboard_version + run: echo "dashboard_version=$(git describe --tags --always)" >> "$GITHUB_OUTPUT" + - name: Log in to GHCR uses: docker/login-action@v3 with: @@ -79,6 +85,8 @@ jobs: context: . file: ./dashboard/Dockerfile push: true + build-args: | + DASHBOARD_VERSION=${{ steps.dashboard_version.outputs.dashboard_version }} tags: | ${{ steps.meta.outputs.prefix }}/dashboard-frontend:latest ${{ steps.meta.outputs.prefix }}/dashboard-frontend:${{ github.sha }} diff --git a/.github/workflows/deploy-staging.yaml b/.github/workflows/deploy-staging.yaml index e51b67a35..1577ec560 100644 --- a/.github/workflows/deploy-staging.yaml +++ b/.github/workflows/deploy-staging.yaml @@ -68,6 +68,8 @@ jobs: cp ~/.env-staging dashboard-staging/.env && cd dashboard-staging && git checkout ${GITHUB_SHA} && + git fetch --tags --unshallow || true && + export DASHBOARD_VERSION=\$(git describe --tags --always) && docker compose pull --ignore-buildable --policy=always && docker compose build --no-cache && docker compose up -d --remove-orphans diff --git a/dashboard/Dockerfile b/dashboard/Dockerfile index c09726261..53fd5237b 100644 --- a/dashboard/Dockerfile +++ b/dashboard/Dockerfile @@ -8,6 +8,9 @@ RUN npm install -g pnpm@10.33.3 && pnpm install --frozen-lockfile COPY dashboard/. ./ +ARG DASHBOARD_VERSION +ENV VITE_DASHBOARD_VERSION=$DASHBOARD_VERSION + RUN pnpm build # Stage 2: Copy the static files from the builder stage diff --git a/dashboard/src/components/SideMenu/SideMenuContent.tsx b/dashboard/src/components/SideMenu/SideMenuContent.tsx index 31fde4cf7..c9b4d0225 100644 --- a/dashboard/src/components/SideMenu/SideMenuContent.tsx +++ b/dashboard/src/components/SideMenu/SideMenuContent.tsx @@ -16,6 +16,8 @@ import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/Tooltip'; import { ExternalLinkIcon } from '@/components/Icons/ExternalLink'; +import { REPO_URL } from '@/utils/constants/general'; + import SendFeedback from './SendFeedback'; import NavLink from './NavLink'; import { @@ -25,6 +27,19 @@ import { type RouteMenuItems, } from './menuItems'; +const versionRepoUrl = (version: string): string => { + if (!version || version === 'unknown' || version.endsWith('-dirty')) { + return REPO_URL; + } + + const commitAfterTag = version.match(/-g([0-9a-f]+)$/)?.[1]; + if (commitAfterTag) { + return `${REPO_URL}/tree/${commitAfterTag}`; + } + + return `${REPO_URL}/tree/${version}`; +}; + type SideMenuItemProps = { item: RouteMenuItems; }; @@ -124,6 +139,15 @@ const SideMenuContent = ({