使用脚本一次性将标签推送到多个git存储库中。
使用代码指南:
请提出改进建议。
::Custom Script
echo off
setlocal ENABLEDELAYEDEXPANSION
set Project_Home=D:\Jwork
set Project=Tagging
set repoURL=https://github.com...
Set Tag=<VersioinTest>
Set branch=master
d:
echo Auto tagging in progress...
cd "%Project_Home%\%Project%"
set repList=maven-repo
echo List of repositories configured for tagging: "%repList%"
for %%a in ("%repList:,=" "%") do (
IF NOT EXIST "%Project_Home%\%Project%\%%a" (
mkdir %%a
if %ERRORLEVEL% == 0 (
echo folder created %%a successfully.
)
if NOT %ERRORLEVEL% == 0 (
echo Error in initializing %%a. Please see stack trace ...
exit
)
cd "%%a"
git init
if %ERRORLEVEL% == 0 (
echo %%a initilized successfully.
)
if NOT %ERRORLEVEL% == 0 (
echo Error in initializing %%a. Please see stack trace ...
exit
)
)
cd "%Project_Home%\%Project%\%%a"
git pull %repoURL%/%%a
pause
IF EXIST "%Project_Home%\%Project%\%%a" (
git tag -a %Tag% -m "Tag repository %%a"
if %ERRORLEVEL% == 0 (
echo try to tag %%a.
)
if NOT %ERRORLEVEL% == 0 (
echo Error in tagging %%a. Please see stack trace ...
exit
)
git push %repoURL%/%%a tag %Tag%
if %ERRORLEVEL% == 0 (
echo try to puch tag %%a.
)
if NOT %ERRORLEVEL% == 0 (
echo Error in pushing tag %%a. Please see stack trace ...
exit
)
) ELSE (
echo Repository %%a folder not found for tagging.
exit
)
)
pause
exit