fix(version): read CI_COMMIT_TAG as source of truth, package.json as fallback

Previously: vite read package.json.version only, requiring manual bump
before each tag pipeline (manual sync ломалось — MR !44 пример костыля).

Now: vite reads CI_COMMIT_TAG (passed via Dockerfile ARG GIT_TAG from
.gitlab-ci.yml .docker_base) → strips 'v' prefix → exposes как __APP_TAG__.
'none' sentinel filtered → empty string → fallback к package.json.

VersionBadge priority chain:
  1. serverTag (что прод RUNS, через /api/v1/version)
  2. clientTag (что build'илось на tag pipeline)
  3. v${clientVersion} (package.json fallback floor для local / branch)

Dockerfile: add ARG GIT_TAG=none, ENV CI_COMMIT_TAG=$GIT_TAG (mirrors
существующий pattern с GIT_COMMIT → CI_COMMIT_SHORT_SHA).

Revert package.json 1.3.1 → 1.2.0 (manual bump из MR !44). Версия теперь
follows tag, не наоборот.
This commit is contained in:
Zimin A.N.
2026-05-11 14:19:50 +03:00
parent 71432e9ae7
commit e62633d903
6 changed files with 55 additions and 17 deletions
+9
View File
@@ -13,7 +13,16 @@ interface ImportMeta {
* Build identity injected via Vite {@code define} (см. vite.config.ts).
* Используются {@code useAppVersion} hook + {@code UpdateBanner} component
* для server-vs-client comparison.
*
* <ul>
* <li>__APP_VERSION__ — package.json.version (fallback floor).</li>
* <li>__APP_TAG__ — CI_COMMIT_TAG без 'v' префикса. Пустая строка для
* branch / local builds. Authoritative для release builds.</li>
* <li>__APP_COMMIT__ — 8-char short SHA.</li>
* <li>__APP_BUILT_AT__ — ISO timestamp когда vite собирал bundle.</li>
* </ul>
*/
declare const __APP_VERSION__: string
declare const __APP_TAG__: string
declare const __APP_COMMIT__: string
declare const __APP_BUILT_AT__: string