-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion.bat
32 lines (23 loc) · 811 Bytes
/
version.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
@echo off
setlocal EnableDelayedExpansion
set "filePath=%~dp0Output\Info.json"
for /f "tokens=2 delims=:," %%a in ('findstr /i /c:"\"Version\"" "%filePath%"') do (
set "currentVersion=%%~a"
)
for /f "tokens=1-3 delims=." %%a in ("%currentVersion%") do (
set /a "major=%%a, minor=%%b, build=%%c+1"
)
if !build! equ 10 (
set /a "build=0, minor+=1"
)
if !minor! equ 10 (
set /a "minor=0, major+=1"
)
set "newVersion=!major!.!minor!.!build!"
echo New version: !newVersion!
powershell -Command "$json = Get-Content -Path '%filePath%' -Raw | ConvertFrom-Json; $json.Version = '%newVersion%'; $json | ConvertTo-Json -Depth 100 | Set-Content -Path '%filePath%'"
if not !errorlevel! gtr 0 (
echo Failed to update version.
exit /b !errorlevel!
)
echo Info.json file updated successfully.