Compare commits
3 Commits
master
...
branch.v2.
Author | SHA1 | Date | |
---|---|---|---|
2b0305cf3c | |||
85d26d779b | |||
603a1a60d0 |
@ -1 +0,0 @@
|
||||
.
|
@ -1 +0,0 @@
|
||||
.
|
@ -1 +1 @@
|
||||
1.0.0.221103145242
|
||||
2.0.0.022401205052
|
||||
|
76
8.version/建立分支.bat
Normal file
76
8.version/建立分支.bat
Normal file
@ -0,0 +1,76 @@
|
||||
@echo off
|
||||
chcp 65001
|
||||
setlocal EnableDelayedExpansion
|
||||
cd /d %~dp0
|
||||
|
||||
net.exe session 1>NUL 2>NUL && (
|
||||
goto as_admin
|
||||
) || (
|
||||
goto not_admin
|
||||
)
|
||||
|
||||
:as_admin
|
||||
set versionPath=%cd%
|
||||
cd ..
|
||||
set rootPath=%cd%
|
||||
|
||||
::读取项目配置
|
||||
set appName="xxxxx"
|
||||
set file99=%rootPath%\config.txt
|
||||
if exist %file99% (
|
||||
for /f "tokens=*" %%a in (%file99%) do (
|
||||
set var=%%a
|
||||
|
||||
if "!var:~0,16!"=="applicationName:" (
|
||||
set appName=!var:~16,-1!!var:~-1,1!
|
||||
)
|
||||
)
|
||||
set appName=!appName!
|
||||
)
|
||||
|
||||
::检查是否主干项目
|
||||
if not exist %rootPath%\%appName%.master (
|
||||
echo 当前不是主干,不能建立分支,请先建立 %rootPath%\%appName%.master
|
||||
goto end
|
||||
)
|
||||
|
||||
::读取版本配置文件
|
||||
cd /d %versionPath%
|
||||
if not exist version.txt echo 1.0.0.20000101>version.txt
|
||||
set configVersion=version.txt
|
||||
for /f "tokens=1,2,3 delims=." %%a IN (%configVersion%) Do (
|
||||
set tag1=%%a
|
||||
set tag2=%%b
|
||||
set tag3=%%c
|
||||
)
|
||||
set oldVersion=!tag1!.!tag2!.!tag3!
|
||||
set /a tag3=1+!tag3!
|
||||
set newVersion=!tag1!.!tag2!.!tag3!
|
||||
set branchName=branch.v%newVersion%
|
||||
git checkout -b %branchName%
|
||||
del /s /q %rootPath%\%appName%.master
|
||||
del /s /q %rootPath%\%appName%.branch.*
|
||||
echo .>%rootPath%\%appName%.branch.v%newVersion%
|
||||
|
||||
set productname=%newVersion%.%d:~2,2%%d:~5,2%%d:~8,2%%t:~0,2%%t:~3,2%%t:~6,2%
|
||||
echo 新版本:%productname%
|
||||
echo %productname%>%versionPath%\version.txt
|
||||
del /s /q %versionPath%\*.panda
|
||||
del /s /q %rootPath%\*.panda
|
||||
|
||||
cd /d %rootPath%
|
||||
git add .
|
||||
git commit -m "创建分支 %appName%.branch.v%newVersion%"
|
||||
|
||||
git push origin %branchName%
|
||||
|
||||
echo 执行成功,生成 %appName%.branch.v%newVersion%
|
||||
goto end
|
||||
|
||||
:not_admin
|
||||
echo not as admin
|
||||
|
||||
:end
|
||||
ping 127.0.0.1 -n 10 >nul
|
||||
exit
|
||||
|
@ -1,4 +1,5 @@
|
||||
@echo off
|
||||
chcp 65001
|
||||
setlocal EnableDelayedExpansion
|
||||
cd /d %~dp0
|
||||
|
||||
@ -9,7 +10,31 @@ net.exe session 1>NUL 2>NUL && (
|
||||
)
|
||||
|
||||
:as_admin
|
||||
::读取版本配置文件
|
||||
set versionPath=%cd%
|
||||
cd ..
|
||||
set rootPath=%cd%
|
||||
::读取配置
|
||||
set appName="xxxxx"
|
||||
set file99=%rootPath%\config.txt
|
||||
if exist %file99% (
|
||||
for /f "tokens=*" %%a in (%file99%) do (
|
||||
set var=%%a
|
||||
|
||||
if "!var:~0,16!"=="applicationName:" (
|
||||
set appName=!var:~16,-1!!var:~-1,1!
|
||||
)
|
||||
)
|
||||
set appName=!appName!
|
||||
)
|
||||
if not exist %rootPath%\%appName%.master (
|
||||
echo 只有master主干,才能建立新版本
|
||||
goto end
|
||||
)
|
||||
|
||||
del /s /q %rootPath%\%appName%.branch.v*
|
||||
|
||||
::读取版本配置文件
|
||||
cd /d %versionPath%
|
||||
if not exist version.txt echo 1.0.0.20000101>version.txt
|
||||
set configVersion=version.txt
|
||||
for /f "tokens=1,2,3 delims=." %%a IN (%configVersion%) Do (
|
||||
@ -19,19 +44,19 @@ for /f "tokens=1,2,3 delims=." %%a IN (%configVersion%) Do (
|
||||
)
|
||||
set oldVersion=%tag1%.%tag2%.%tag3%
|
||||
|
||||
::提交数据,并打包为节点
|
||||
::提交数据,并打包为节点
|
||||
set verPath=%cd%
|
||||
cd ..
|
||||
set rootPath=%cd%
|
||||
cd /d %rootPath%
|
||||
set tagName=%oldVersion%_%date:~0,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%
|
||||
git tag -a %tagName% -m 建立节点
|
||||
git tag -a %tagName% -m 建立节点
|
||||
git push origin %tagName%
|
||||
|
||||
set /a tag3=1+%tag3%
|
||||
set newVersion=%tag1%.%tag2%.%tag3%
|
||||
|
||||
::替换
|
||||
::替换
|
||||
set d=%date: =0%
|
||||
set t=%time: =0%
|
||||
|
||||
@ -46,7 +71,7 @@ cd ..
|
||||
del /q *.panda
|
||||
echo .>%newVersion%.panda
|
||||
|
||||
echo 执行成功,生成 v%oldVersion%
|
||||
echo 执行成功,生成 v%oldVersion%
|
||||
goto end
|
||||
|
||||
:not_admin
|
||||
|
Loading…
x
Reference in New Issue
Block a user