Files
rip-help-system/show-version.bat
2026-09-11 14:21:54 +03:00

33 lines
1.1 KiB
Batchfile
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@echo off
setlocal EnableExtensions EnableDelayedExpansion
chcp 65001 > nul
rem Същите ключове като GET /healthz: ok, version, git.
rem Префиксът е от VERSION; SHA е от git (не може да е в commit-натия файл).
rem Двоен клик / без аргументи — pause. От терминал: show-version.bat -q
set "ROOT=%~dp0"
if "%ROOT:~-1%"=="\" set "ROOT=%ROOT:~0,-1%"
cd /d "%ROOT%"
set "APP_VERSION=0.3.0"
if exist "%ROOT%\VERSION" (
set /p APP_VERSION=<"%ROOT%\VERSION"
)
set "GIT_SHA=dev"
set "SHA_FILE=%TEMP%\rip-help-git-sha.txt"
git rev-parse --short=7 HEAD > "%SHA_FILE%" 2>nul
if exist "%SHA_FILE%" (
set /p GIT_SHA=<"%SHA_FILE%"
del "%SHA_FILE%" >nul 2>&1
)
if not defined GIT_SHA set "GIT_SHA=dev"
if "!GIT_SHA!"=="" set "GIT_SHA=dev"
echo {"ok": true, "version": "%APP_VERSION%+!GIT_SHA!", "git": "!GIT_SHA!"}
echo.
echo Сравни "git" с https://rip.inex-project.net/healthz
echo Production вижда SHA едва след commit + push + Coolify redeploy.
echo.
if /i not "%~1"=="-q" pause