Skip to content

Commit 0d5186f

Browse files
committed
Release batch file now also pushes to nuget and tags the commit in the git repository
1 parent 47c5ef1 commit 0d5186f

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

release.bat

+22-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
setlocal
44

5+
del *.nupkg
6+
if errorlevel 1 goto error
7+
58
if "%SIGNINGKEYS%" == "" goto setup
69

7-
set year=%date:~6,4%
8-
set month=%date:~3,2%
9-
set day=%date:~0,2%
10-
set tm=%time:~0,2%%time:~3,2%
10+
set /A year=%date:~6,4%
11+
set /A month=%date:~3,2%
12+
set /A day=%date:~0,2%
13+
set /A tm=%time:~0,2%%time:~3,2%
1114

1215
copy "%SIGNINGKEYS%\Lasse V. Karlsen Private.snk" "DiffLib\Lasse V. Karlsen.snk"
1316
if errorlevel 1 goto error
@@ -18,13 +21,26 @@ if errorlevel 1 goto error
1821
nuget restore
1922
if errorlevel 1 goto error
2023

21-
msbuild DiffLib\DiffLib.csproj /target:Clean,Rebuild /p:Configuration=Release /p:Version=%year%.%month%.%day%.%tm%
24+
set VERSION=%year%.%month%.%day%.%tm%
25+
msbuild DiffLib\DiffLib.csproj /target:Clean,Rebuild /p:Configuration=Release /p:Version=%VERSION%
2226
if errorlevel 1 goto error
2327

2428
copy DiffLib\bin\Release\DiffLib*.nupkg .\
2529
if errorlevel 1 goto error
2630

2731
git checkout "DiffLib\Lasse V. Karlsen.snk"
32+
33+
echo=
34+
echo================================================
35+
set /P PUSHYESNO=Push package to nuget? [y/N]
36+
if "%PUSHYESNO%" == "Y" GOTO PUSH
37+
exit /B 0
38+
39+
:PUSH
40+
nuget push DiffLib.%VERSION%.nupkg -Source https://www.nuget.org/api/v2/package
41+
if errorlevel 1 goto error
42+
git tag version/%VERSION%
43+
if errorlevel 1 goto error
2844
exit /B 0
2945

3046
:error
@@ -36,3 +52,4 @@ goto exitwitherror
3652

3753
:exitwitherror
3854
git checkout "DiffLib\Lasse V. Karlsen.snk"
55+
exit /B 1

0 commit comments

Comments
 (0)