feat(frontend): inject commit ID into frontend build for version tracking

- Added a new build argument `COMMIT_ID_ARG` to pass the commit ID during the Docker build process.
- Updated the Dockerfile to set an environment variable `VITE_FRONTEND_COMMIT` with the commit ID.
- Enhanced the Vite configuration to resolve the frontend commit ID from the environment or Git.
- Modified the SystemInfo component to display the frontend commit ID in the UI.
- Implemented a version info preparation step in the GitHub Actions workflow to capture the commit ID.
This commit is contained in:
wizardchen
2026-06-09 17:50:00 +08:00
committed by lyingbug
parent 4de3c3efbd
commit 589d2a6e52
7 changed files with 42 additions and 1 deletions
+8
View File
@@ -32,6 +32,12 @@ jobs:
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/weknora-ui
- name: Prepare version info
id: version
run: |
eval "$(./scripts/get_version.sh env)"
echo "commit_id=$COMMIT_ID" >> $GITHUB_OUTPUT
- name: Build ui Image
uses: docker/build-push-action@v7
with:
@@ -39,6 +45,8 @@ jobs:
platforms: linux/amd64,linux/arm64
file: frontend/Dockerfile
context: ./frontend
build-args: |
${{ format('COMMIT_ID_ARG={0}', steps.version.outputs.commit_id) }}
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha,scope=build-ui