fix(settings): show the real web app version

The card always displayed 1.0.0. VITE_APP_VERSION was never set: CI
passes the release tag as a VERSION build arg, but the Dockerfile never
declared it or forwarded it to the frontend build, so the hardcoded
fallback always won.

Declare the build arg and export it as VITE_APP_VERSION, and resolve the
version in vite.config.ts for every other build: the env var, then the
release tag via git describe, then package.json. The image version label
was pinned at 1.0.0 for the same reason and now follows the arg too.
This commit is contained in:
Darkraise
2026-08-12 21:32:49 +07:00
parent aed4e4914d
commit 9c85284798
8 changed files with 67 additions and 6 deletions
+7 -1
View File
@@ -142,9 +142,15 @@ calls are automatically proxied through Vite to the backend.
**Optional (production builds):**
```bash
VITE_APP_VERSION=1.0.0 # Displayed app version
VITE_APP_VERSION=1.0.38 # Displayed app version
```
`vite.config.ts` resolves the version at build time: `VITE_APP_VERSION` if set,
otherwise the release tag via `git describe`, otherwise `package.json`. Set it
explicitly only where neither is available — the Docker image carries no `.git`,
so CI passes the tag in through the `VERSION` build arg. Read it in components
from `@/lib/version`, never from `import.meta.env` directly.
## Project Structure
```
+4 -1
View File
@@ -208,7 +208,10 @@ JWT_EXPIRES_IN=1h
```env
# No environment variables required for local development
# API calls are proxied through Vite (dev) or Nginx (production)
VITE_APP_VERSION=1.0.0 # Optional: displayed app version
# Optional: displayed app version. Defaults to the release tag via `git
# describe`, then to frontend/package.json. The Docker build has no .git, so
# CI passes the tag through the VERSION build arg instead.
VITE_APP_VERSION=1.0.38
```
#### Game Service