Files
spark/src/sdk/update_github.cmd
T

68 lines
1.4 KiB
Batchfile

@echo off
setlocal
set STAGE="c:\temp\bts_staging"
set SDK="spark_client_sdk"
set SRC=%1
set GH=%2
set TG=%3
set OPP=%4
if "%SRC%" == "" goto :help
if "%GH%" == "" goto :help
if "%TG%" == "" goto :help
if "%TG%" == "stage" echo "STAGE ONLY"
if exist %STAGE% rmdir /s /q %STAGE%
mkdir %STAGE%
git clone --recurse-submodules "%GH%" %STAGE%\\%SDK%
del /q "%STAGE%\\%SDK%\\*"
FOR /D %%p IN ("%STAGE%\\%SDK%\*.*") DO (
REM this skips git
if NOT "%%p" == ".git" (
rmdir /s /q "%%p"
)
)
FOR %%i IN ("%src%") DO (
set filedrive=%%~di
set filepath=%%~pi
set filename=%%~ni
set fileextension=%%~xi
if "%%~xi" == ".nupkg" (
rem unzip -o %%i -d %STAGE%\\%SDK%\\
7z x -o%STAGE%\\%SDK%\\ -y -spe %%i
rmdir /Q /S %STAGE%\\%SDK%\\_rels
rmdir /Q /S %STAGE%\\%SDK%\\package
del /Q %STAGE%\\%SDK%\\spark_sdk.nuspec
del /Q %STAGE%\\%SDK%\\[Content_Types].xml
) else (
copy /Y /E %%i %STAGE%\\%SDK%\\
)
)
pushd %STAGE%\%SDK%\
if NOT "%TG%" == "stage" (
git status
git add .
git commit -m "%SDK% update %TG%"
git tag "%TG%"
git push origin master --tags %OPP%
popd
rmdir /s /q %STAGE%
)
goto :eof
:help
echo.
echo update_github.cmd ^<source^> ^<https://github.com/your_repo/%SDK%.git^> [tag] [-push_params]
echo.
echo source can be a nupkg file or a folder
echo.
echo set tag to 'stage' if you don't want to push
goto :eof