2016-02-23 19:33:05 +00:00
|
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
|
|
Publishes NuGet packages to nuget.org.
|
|
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
This script is intended to be used by project maintainers only.
|
|
|
|
Secret API key is required to publish the module.
|
|
|
|
#>
|
2018-12-30 19:05:44 +00:00
|
|
|
#Requires -Version 5
|
2016-02-23 19:33:05 +00:00
|
|
|
|
|
|
|
$repoRoot = Join-Path $PSScriptRoot '..\'
|
|
|
|
$packagesDir = Join-Path $repoRoot 'Build\packages\'
|
|
|
|
|
2017-03-26 16:54:30 +00:00
|
|
|
# NuGet.org API
|
2018-12-30 19:05:44 +00:00
|
|
|
$nugetGallery = 'https://www.nuget.org/api/v2/package'
|
|
|
|
$nugetExeUrl = 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe'
|
|
|
|
|
|
|
|
# Download nuget.exe to Tools
|
|
|
|
$toolsDirectoryPath = Join-Path $repoRoot 'Scripts\Tools'
|
|
|
|
$nuget = Join-Path $toolsDirectoryPath 'nuget.exe'
|
|
|
|
if(-not (Test-Path $nuget))
|
|
|
|
{
|
|
|
|
mkdir $toolsDirectoryPath
|
|
|
|
Invoke-WebRequest -Uri $nugetExeUrl -OutFile $nuget
|
|
|
|
}
|
2017-03-26 16:54:30 +00:00
|
|
|
|
2016-02-23 19:33:05 +00:00
|
|
|
# Load the API key and exit on error
|
|
|
|
$apiKeyPath = Join-Path $repoRoot 'Keys\NuGet.key'
|
|
|
|
$apiKey = Get-Content $apiKeyPath -ErrorAction Stop
|
|
|
|
|
|
|
|
Get-ChildItem -Path $packagesDir -Filter *.nupkg -Recurse -File |
|
|
|
|
ForEach-Object {
|
|
|
|
$packagePath = $PSItem.FullName
|
2018-12-30 19:05:44 +00:00
|
|
|
& $nuget push $packagePath -ApiKey $apiKey -Source $nugetGallery -NonInteractive -Verbosity detailed
|
2016-02-23 19:33:05 +00:00
|
|
|
}
|