forked from X-Hax/SA-Mod-Manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReleaseNewUpdate.bat
49 lines (41 loc) · 1.1 KB
/
ReleaseNewUpdate.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
@echo off
setlocal enabledelayedexpansion
:input
set /p version=Enter a version number (x.y.z format, example: 1.0.5):
REM Check if the input matches the expected format (x.y.z)
for /f "tokens=1-3 delims=." %%a in ("!version!") do (
set "major=%%a"
set "minor=%%b"
set "patch=%%c"
)
REM Check if major, minor, and patch are numeric
echo !major!|findstr /r /c:"^[0-9]*$" >nul
if errorlevel 1 (
echo Invalid version number format. Please use the x.y.z format.
goto input
)
echo !minor!|findstr /r /c:"^[0-9]*$" >nul
if errorlevel 1 (
echo Invalid version number format. Please use the x.y.z format.
goto input
)
echo !patch!|findstr /r /c:"^[0-9]*$" >nul
if errorlevel 1 (
echo Invalid version number format. Please use the x.y.z format.
goto input
)
REM If the input is valid, you can execute your specific code here
echo Valid version number: !version!
git tag -a !version! HEAD -m "Release !version!"
if errorlevel 1 (
echo Failed to create Git tag.
goto end
)
git push --follow-tags
if errorlevel 1 (
echo Failed to push Git tags.
goto end
)
:end
endlocal
pause