From a61951049f673f1a24c9d8c5df48a66090aa66cf Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Wed, 4 Jun 2025 15:49:07 +0100 Subject: [PATCH] Enhance webapp version with build info (#2146) * improve app version output * set build info * fix typo * always show additional build info when self-hosting * Update apps/webapp/app/routes/_app.orgs.$organizationSlug.settings/route.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * Update apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix build timestamp name --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .github/workflows/publish-webapp.yml | 16 ++++++++ .../OrganizationSettingsSideMenu.tsx | 41 +++++++++++++++++-- .../route.tsx | 19 ++++++--- docker/Dockerfile | 10 +++++ 4 files changed, 78 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-webapp.yml b/.github/workflows/publish-webapp.yml index 246a8ea31..ed5a259a8 100644 --- a/.github/workflows/publish-webapp.yml +++ b/.github/workflows/publish-webapp.yml @@ -56,6 +56,17 @@ jobs: echo "image_tags=${image_tags}" >> "$GITHUB_OUTPUT" + - name: 📝 Set the build info + id: set_build_info + run: | + tag=${{ steps.get_tag.outputs.tag }} + if [[ "${{ steps.get_tag.outputs.is_semver }}" == true ]]; then + echo "BUILD_APP_VERSION=${tag}" >> "$GITHUB_OUTPUT" + fi + echo "BUILD_GIT_SHA=${{ github.sha }}" >> "$GITHUB_OUTPUT" + echo "BUILD_GIT_REF_NAME=${{ github.ref_name }}" >> "$GITHUB_OUTPUT" + echo "BUILD_TIMESTAMP_SECONDS=$(date +%s)" >> "$GITHUB_OUTPUT" + - name: 🐙 Login to GitHub Container Registry uses: docker/login-action@v3 with: @@ -70,3 +81,8 @@ jobs: platforms: linux/amd64,linux/arm64 tags: ${{ steps.set_tags.outputs.image_tags }} push: true + build-args: | + BUILD_APP_VERSION=${{ steps.set_build_info.outputs.BUILD_APP_VERSION }} + BUILD_GIT_SHA=${{ steps.set_build_info.outputs.BUILD_GIT_SHA }} + BUILD_GIT_REF_NAME=${{ steps.set_build_info.outputs.BUILD_GIT_REF_NAME }} + BUILD_TIMESTAMP_SECONDS=${{ steps.set_build_info.outputs.BUILD_TIMESTAMP_SECONDS }} diff --git a/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx b/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx index 694ac8756..fe9d14652 100644 --- a/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx +++ b/apps/webapp/app/components/navigation/OrganizationSettingsSideMenu.tsx @@ -22,16 +22,27 @@ import { SideMenuItem } from "./SideMenuItem"; import { useCurrentPlan } from "~/routes/_app.orgs.$organizationSlug/route"; import { Paragraph } from "../primitives/Paragraph"; import { Badge } from "../primitives/Badge"; +import { useHasAdminAccess } from "~/hooks/useUser"; + +export type BuildInfo = { + appVersion: string | undefined; + packageVersion: string; + buildTimestampSeconds: string | undefined; + gitSha: string | undefined; + gitRefName: string | undefined; +}; export function OrganizationSettingsSideMenu({ organization, - version, + buildInfo, }: { organization: MatchedOrganization; - version: string; + buildInfo: BuildInfo; }) { const { isManagedCloud } = useFeatures(); const currentPlan = useCurrentPlan(); + const isAdmin = useHasAdminAccess(); + const showBuildInfo = isAdmin || !isManagedCloud; return (