-
Notifications
You must be signed in to change notification settings - Fork 40
/
upload-packages.cmd
47 lines (35 loc) · 1.03 KB
/
upload-packages.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@echo Off
if /i "%~1" == "/?" Goto :Usage
if /i "%~1" == "-?" Goto :Usage
if /i "%~1" == "--help" Goto :Usage
if /i "%~1" == "" Goto :Usage
if /i "%~2" == "" Goto :Usage
set ExitCode=0
set PackageDirectory=%~1
echo:
echo [Uploading NuGet Packages]
echo --------------------------------------------------
echo Package Directory : %PackageDirectory%
echo Feed : %FeedUri%
echo:
for %%f in (%PackageDirectory%\*.nupkg) do (
call dotnet nuget push %%f --api-key %~2 --timeout 1200 --source https://api.nuget.org/v3/index.json --skip-duplicate %~3 && echo: || Goto :Error
)
Goto :End
:Usage
echo Invalid Usage.
echo Usage:
echo %~0 {packageDirectory} {nugetApiKey} [{dotnet push args}]
echo:
echo Examples:
echo %~0 S:\source\one\repo\out\bin\Release\x64\Packages apikey
echo %~0 S:\source\one\repo\out\bin\Release\x64\Packages apikey --interactive
Goto :End
:Error
set ExitCode=%ERRORLEVEL%
:End
rem Reset environment variables
set PackageDirectory=
set FeedUri=
echo Build Stage Exit/Error Code: %ExitCode%
exit /B %ExitCode%