diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index c612c271..991b6238 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: npm run build env: REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} - VITE_APP_VERSION: ${{ github.ref_name }}@${{ github.sha }} + VITE_APP_VERSION: ${{ github.sha }} - name: Build and Test run: mvn clean verify -DskipITs -U --batch-mode @@ -112,9 +112,11 @@ jobs: for TAG in $IMAGE_TAGS; do TAGS="$TAGS -t gitea.siegeln.net/cameleer/cameleer3-server-ui:$TAG" done + SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7) docker buildx build --platform linux/amd64 \ -f ui/Dockerfile \ --build-arg REGISTRY_TOKEN="$REGISTRY_TOKEN" \ + --build-arg VITE_APP_VERSION="$SHORT_SHA" \ $TAGS \ --cache-from type=registry,ref=gitea.siegeln.net/cameleer/cameleer3-server-ui:buildcache \ --cache-to type=registry,ref=gitea.siegeln.net/cameleer/cameleer3-server-ui:buildcache,mode=max \ diff --git a/ui/Dockerfile b/ui/Dockerfile index a89d813a..1029cec1 100644 --- a/ui/Dockerfile +++ b/ui/Dockerfile @@ -14,7 +14,9 @@ RUN echo "//gitea.siegeln.net/api/packages/cameleer/npm/:_authToken=${REGISTRY_T rm -f .npmrc ARG VITE_ENV_NAME=PRODUCTION +ARG VITE_APP_VERSION=dev ENV VITE_ENV_NAME=$VITE_ENV_NAME +ENV VITE_APP_VERSION=$VITE_APP_VERSION RUN npm run build FROM nginx:1.27-alpine diff --git a/ui/vite.config.ts b/ui/vite.config.ts index 1f0d0a7d..b4e74e8d 100644 --- a/ui/vite.config.ts +++ b/ui/vite.config.ts @@ -7,7 +7,7 @@ const apiTarget = process.env.VITE_API_TARGET || 'http://localhost:8081'; export default defineConfig({ define: { - __APP_VERSION__: JSON.stringify(process.env.VITE_APP_VERSION || 'dev'), + __APP_VERSION__: JSON.stringify((process.env.VITE_APP_VERSION || 'dev').slice(0, 7)), }, plugins: [react()], server: {