-
Notifications
You must be signed in to change notification settings - Fork 6
/
nupack.ps1
41 lines (34 loc) · 1.61 KB
/
nupack.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
############### Create and push a nuget package #########################
#--------------------------------------------------------------------------
###########################################################################
[CmdletBinding()]
Param(
[Parameter(Mandatory=$false)]
[string]$k = "somekindofkey",
# Set the version
[Parameter(Mandatory=$false)]
[string]$v = "1.0.0",
# Show help
[Parameter(Mandatory=$false)]
[switch]$h = $false
)
if ($h -or $key -eq "somekindofkey" ){
Write-Host "==============================="
Write-Host "Parameters:"
Write-Host " -h : This documentation"
Write-Host " -v : Nuget version of package"
Write-Host " -k thenugetkey : Use that key to publish the package"
Write-Host "==============================="
exit 0;
}
$nupkgs = "$((Get-Location).Path)\nupkgs"
# Remove all the files from the nupkgs folder
Get-ChildItem "$((Get-Location).Path)\nupkgs" | ForEach-Object { $_.Delete() }
$cmd = "dotnet build ./CognitiveServices.Translator.Client/CognitiveServices.Translator.Client.csproj -c=Release"
Invoke-Expression $cmd
# Build and pack
$cmd = "dotnet pack ./CognitiveServices.Translator.Client/CognitiveServices.Translator.Client.csproj /p:PackageVersion=$v --include-source --include-symbols -c=Release -o $nupkgs"
Invoke-Expression $cmd
# Ask if we really want to push the packages.
$cmd = "dotnet nuget push $nupkgs\CognitiveServices.Translator.Client.$v.nupkg -s=https://api.nuget.org/v3/index.json -ss=https://nuget.smbsrc.net -k=$k --force-english-output"
Invoke-Expression $cmd