forked from nvincent/DsmWebApi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPublish-DsmWebApiRelease.ps1
37 lines (34 loc) · 993 Bytes
/
Publish-DsmWebApiRelease.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
function Publish-DsmWebApiRelease
{
<#
.SYNOPSIS
Publishes the NuGet packages created by the Build-DsmWebApiRelease command
.DESCRIPTION
Publishes the NuGet packages to nuget.org
.PARAMETER Version
Version of the project to publish
.PARAMETER SourcesDir
Root sources directory
.PARAMETER OutDir
Output directory of the build
.EXAMPLE
Buils :
Build-DsmWebApiRelease
#>
param([parameter(Mandatory = $true)][string]$Version
,[parameter(Mandatory = $true)][string]$SourcesDir
,[parameter(Mandatory = $true)][string]$OutDir
)
# Expand paths
$SourcesDir = Resolve-Path $SourcesDir
$OutDir = Resolve-Path $OutDir
# Get NuGet.exe
$nuget = Join-Path $SourcesDir ".nuget\NuGet.exe"
$packagesDir = Join-Path $OutDir "NuGet"
$packages = Get-ChildItem $packagesDir `
| ForEach-Object { $_.FullName } `
| Where-Object { $_ -like "*.$Version.nupkg" }
$packages | ForEach-Object {
&$nuget push $_
}
}