fix: pass commit short hash as version to UI sidebar
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:
@@ -53,7 +53,7 @@ jobs:
|
|||||||
npm run build
|
npm run build
|
||||||
env:
|
env:
|
||||||
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
VITE_APP_VERSION: ${{ github.ref_name }}@${{ github.sha }}
|
VITE_APP_VERSION: ${{ github.sha }}
|
||||||
|
|
||||||
- name: Build and Test
|
- name: Build and Test
|
||||||
run: mvn clean verify -DskipITs -U --batch-mode
|
run: mvn clean verify -DskipITs -U --batch-mode
|
||||||
@@ -112,9 +112,11 @@ jobs:
|
|||||||
for TAG in $IMAGE_TAGS; do
|
for TAG in $IMAGE_TAGS; do
|
||||||
TAGS="$TAGS -t gitea.siegeln.net/cameleer/cameleer3-server-ui:$TAG"
|
TAGS="$TAGS -t gitea.siegeln.net/cameleer/cameleer3-server-ui:$TAG"
|
||||||
done
|
done
|
||||||
|
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-7)
|
||||||
docker buildx build --platform linux/amd64 \
|
docker buildx build --platform linux/amd64 \
|
||||||
-f ui/Dockerfile \
|
-f ui/Dockerfile \
|
||||||
--build-arg REGISTRY_TOKEN="$REGISTRY_TOKEN" \
|
--build-arg REGISTRY_TOKEN="$REGISTRY_TOKEN" \
|
||||||
|
--build-arg VITE_APP_VERSION="$SHORT_SHA" \
|
||||||
$TAGS \
|
$TAGS \
|
||||||
--cache-from type=registry,ref=gitea.siegeln.net/cameleer/cameleer3-server-ui:buildcache \
|
--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 \
|
--cache-to type=registry,ref=gitea.siegeln.net/cameleer/cameleer3-server-ui:buildcache,mode=max \
|
||||||
|
|||||||
@@ -14,7 +14,9 @@ RUN echo "//gitea.siegeln.net/api/packages/cameleer/npm/:_authToken=${REGISTRY_T
|
|||||||
rm -f .npmrc
|
rm -f .npmrc
|
||||||
|
|
||||||
ARG VITE_ENV_NAME=PRODUCTION
|
ARG VITE_ENV_NAME=PRODUCTION
|
||||||
|
ARG VITE_APP_VERSION=dev
|
||||||
ENV VITE_ENV_NAME=$VITE_ENV_NAME
|
ENV VITE_ENV_NAME=$VITE_ENV_NAME
|
||||||
|
ENV VITE_APP_VERSION=$VITE_APP_VERSION
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
FROM nginx:1.27-alpine
|
FROM nginx:1.27-alpine
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ const apiTarget = process.env.VITE_API_TARGET || 'http://localhost:8081';
|
|||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
define: {
|
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()],
|
plugins: [react()],
|
||||||
server: {
|
server: {
|
||||||
|
|||||||
Reference in New Issue
Block a user