-
Notifications
You must be signed in to change notification settings - Fork 7
/
PublishToPSGallery.ps1
34 lines (28 loc) · 1.08 KB
/
PublishToPSGallery.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
param (
[Parameter(Mandatory)]
[string] $ApiKey
)
#$VerbosePreference = 'Continue';
$ErrorActionPreference = 'Stop';
$baseDir = $PSScriptRoot;
$PsdPath = Resolve-Path "$PSScriptRoot\PublishDacPac\PublishDacPac.psd1";
$psd = Import-PowershellDataFile $PsdPath;
$ModuleVersion = $psd.ModuleVersion;
Write-Host "Module Version to be published to the Gallery: $ModuleVersion" -ForegroundColor Yellow;
$confirmation = Read-Host "Are you Sure? Type Y to Proceed."
if ($confirmation -eq 'Y') {
try {
.\UpdateHelp.ps1
$buildDir = "$baseDir\PublishDacPac";
Write-Information $buildDir;
Write-Verbose 'Importing PowerShellGet module'
$psGet = Import-Module PowerShellGet -PassThru -Verbose:$false
& $psGet { [CmdletBinding()] param () Install-NuGetClientBinaries -CallerPSCmdlet $PSCmdlet -BootstrapNuGetExe -Force }
Write-Host 'Publishing module using PowerShellGet'
$null = Publish-Module -Path $buildDir -NuGetApiKey $ApiKey -Confirm:$false
}
catch {
Write-Error -ErrorRecord $_
exit 1
}
}