-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.ps1
35 lines (28 loc) · 1.19 KB
/
publish.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
##################################################
#resources
##################################################
#http://www.powershellpro.com/powershell-tutorial-introduction/powershell-tutorial-conditional-logic/
#http://technet.microsoft.com/en-us/library/ee176935.aspx
#http://weblogs.asp.net/soever/archive/2007/02/06/powershell-regerencing-files-relative-to-the-currently-executing-script.aspx
##################################################
#resources
##################################################
param(
$nugetApiKey = "$env:NUGET_API_KEY"
)
function require-param {
param($value, $paramName)
if($value -eq $null) {
write-error "The parameter -$paramName is required."
}
}
require-param $nugetApiKey -paramName "nugetApiKey"
#safely find the solutionDir
$ps1Dir = (Split-Path -parent $MyInvocation.MyCommand.Definition)
$solutionDir = Split-Path -Path $ps1Dir -Parent
$nugetExePath = resolve-path(join-path $solutionDir ".nuget")
$packages = dir "$solutionDir\artifacts\packages\*.nupkg"
foreach($package in $packages) {
#$package is type of System.IO.FileInfo
& "$nugetExePath\Nuget.exe" push $package.FullName $nugetApiKey
}