fix: pass commit short hash as version to UI sidebar
Some checks failed
CI / build (push) Failing after 38s
CI / cleanup-branch (push) Has been skipped
CI / docker (push) Has been skipped
CI / deploy (push) Has been skipped
CI / deploy-feature (push) Has been skipped

Add VITE_APP_VERSION build arg to UI Dockerfile, pass short SHA from
CI docker build step. vite.config.ts truncates to 7 chars so both
CI build and Docker build produce consistent short hashes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-06 22:37:46 +02:00
parent 1386e80670
commit 281e168790
3 changed files with 6 additions and 2 deletions

View File

@@ -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 \

View File

@@ -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

View File

@@ -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: {