Bernt Christian Egeland 7 месяцев назад
Родитель
Сommit
4eef315007

+ 12 - 0
.github/workflows/docker-publish.yml

@@ -31,6 +31,16 @@ jobs:
           username: ${{ github.actor }}
           password: ${{ secrets.GITHUB_TOKEN }}
 
+      - name: Determine version
+        id: version
+        run: |
+          if [[ "${{ github.ref_type }}" == "tag" ]]; then
+            echo "value=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
+          else
+            TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "development")
+            echo "value=${TAG}" >> "$GITHUB_OUTPUT"
+          fi
+
       - name: Extract metadata (tags, labels)
         id: meta
         uses: docker/metadata-action@v5
@@ -47,5 +57,7 @@ jobs:
           push: true
           tags: ${{ steps.meta.outputs.tags }}
           labels: ${{ steps.meta.outputs.labels }}
+          build-args: |
+            APP_VERSION=${{ steps.version.outputs.value }}
           cache-from: type=gha
           cache-to: type=gha,mode=max

+ 2 - 0
Dockerfile

@@ -25,6 +25,8 @@ RUN npm run build
 FROM base AS runner
 WORKDIR /app
 
+ARG APP_VERSION=development
+ENV APP_VERSION=${APP_VERSION}
 ENV NODE_ENV=production
 ENV NEXT_TELEMETRY_DISABLED=1
 

+ 3 - 1
src/app/(authenticated)/settings/about/page.tsx

@@ -3,6 +3,8 @@ import { Separator } from '@/components/ui/separator'
 import { Info } from 'lucide-react'
 
 export default function AboutSettingsPage() {
+  const version = process.env.APP_VERSION || 'development'
+
   return (
     <div className="space-y-6">
       <Card className="border-0 shadow-sm">
@@ -19,7 +21,7 @@ export default function AboutSettingsPage() {
           <div className="space-y-2">
             <div className="flex items-center justify-between">
               <span className="text-sm text-muted-foreground">Version</span>
-              <span className="text-sm font-medium">0.1.0</span>
+              <span className="text-sm font-medium">{version}</span>
             </div>
           </div>
         </CardContent>