-
Notifications
You must be signed in to change notification settings - Fork 3
/
PublishNuget.ps1
61 lines (47 loc) · 1.25 KB
/
PublishNuget.ps1
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
param (
[string]$source = "http://svd0nugetd01/nuget/",
[string]$nuget = "tools\nuget.exe"
)
function DisplayArgs()
{
"Options"
" => source: $source"
" => nuget: $nuget"
"examples"
" publish-nuget.ps1"
" publish-nuget.ps1 -source http://mynuget/nuget/"
" publish-nuget.ps1 -source http://mynuget/nuget/ -nuget c:\nuget\nuget.exe"
""
if (-Not $nuget -eq "")
{
$global:nugetExe = $nuget
}
else
{
# Assumption, nuget.exe is in "..\tools\nuget.exe".
$global:nugetExe = "tools\nuget.exe"
}
$global:nugetExe
if (!(Test-Path $global:nugetExe -PathType leaf))
{
""
"Nuget exe was not found. "
""
throw;
}
}
function Push()
{
$directories = Get-ChildItem -Path . -File -Filter "*.nupkg" -Recurse | ? { $_.FullName -match '.*\\Release\\*.*' } | Select-Object -Property Directory -Unique
foreach($directory in $directories)
{
$latest = Get-ChildItem -Path $directory.Directory -File -Filter "*.nupkg" | Sort-Object LastAccessTime -Descending | Select-Object -First 1
&$nugetExe push ($latest.FullName) -Source $source
""
}
}
$ErrorActionPreference = "Stop"
$global:nugetExe = ""
cls
DisplayArgs
Push