From 9861061df8894a78ba8b2a026215ec8ae9d4638e Mon Sep 17 00:00:00 2001 From: panjia Date: Sun, 7 Jan 2024 21:51:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=88=86=E6=94=AF=20?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=A0=87=E5=87=86=E6=A8=A1=E6=9D=BF.branch.v?= =?UTF-8?q?1.0.3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 8.version/.gitignore | 2 + 8.version/1.0.2.panda | 1 + 8.version/version.txt | 1 + 8.version/建立分支.bat | 67 ++++++++++++++++++++++++++++++++++ 8.version/建立版本.bat | 83 ++++++++++++++++++++++++++++++++++++++++++ 8.version/每次编译.bat | 22 +++++++++++ 6 files changed, 176 insertions(+) create mode 100644 8.version/.gitignore create mode 100644 8.version/1.0.2.panda create mode 100644 8.version/version.txt create mode 100644 8.version/建立分支.bat create mode 100644 8.version/建立版本.bat create mode 100644 8.version/每次编译.bat diff --git a/8.version/.gitignore b/8.version/.gitignore new file mode 100644 index 0000000..f6df554 --- /dev/null +++ b/8.version/.gitignore @@ -0,0 +1,2 @@ +VersionInfo.cs +versiontemp.txt diff --git a/8.version/1.0.2.panda b/8.version/1.0.2.panda new file mode 100644 index 0000000..73fbd95 --- /dev/null +++ b/8.version/1.0.2.panda @@ -0,0 +1 @@ +. diff --git a/8.version/version.txt b/8.version/version.txt new file mode 100644 index 0000000..5dbdcba --- /dev/null +++ b/8.version/version.txt @@ -0,0 +1 @@ +1.0.2.022401205052 diff --git a/8.version/建立分支.bat b/8.version/建立分支.bat new file mode 100644 index 0000000..9c90ce6 --- /dev/null +++ b/8.version/建立分支.bat @@ -0,0 +1,67 @@ +@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% +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 + diff --git a/8.version/建立版本.bat b/8.version/建立版本.bat new file mode 100644 index 0000000..8a59b50 --- /dev/null +++ b/8.version/建立版本.bat @@ -0,0 +1,83 @@ +@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%.panda ( + echo .>%rootPath%\%appName%.panda + echo %appName%.v*>>.gitignore +) + +pause + +::读取版本配置文件 +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 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 push origin %tagName% + +set /a tag3=1+%tag3% +set newVersion=%tag1%.%tag2%.%tag3% + +::替换 +set d=%date: =0% +set t=%time: =0% + +cd /d %verPath% +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%> version.txt +del /q *.panda +echo .>%newVersion%.panda + +cd .. +del /q *.panda +echo .>%newVersion%.panda + +echo 执行成功,生成 v%oldVersion% +goto end + +:not_admin +echo not as admin + +:end +ping 127.0.0.1 -n 10 >nul +exit + diff --git a/8.version/每次编译.bat b/8.version/每次编译.bat new file mode 100644 index 0000000..31702f4 --- /dev/null +++ b/8.version/每次编译.bat @@ -0,0 +1,22 @@ +chcp 65001 +@echo off +cd /d %~dp0 +rem 读取版本配置文件 +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% + +rem 替换 +set d=%date: =0% +set t=%time: =0% + +set productname=%oldVersion%.%d:~2,2%%d:~5,2%%d:~8,2%%t:~0,2%%t:~3,2%%t:~6,2% +echo 新版本号:%productname% +echo %productname%> versiontemp.txt + +exit +