47 lines
1.2 KiB
PowerShell
47 lines
1.2 KiB
PowerShell
function Invoke-Publish {
|
|
<#
|
|
.SYNOPSIS
|
|
Publishes powershell module to internal Nexus repository.
|
|
|
|
.DESCRIPTION
|
|
This Cmdlet is used to publish the module via Drone pipeline.
|
|
|
|
.INPUTS
|
|
[None] No pipeline input.
|
|
|
|
.OUTPUTS
|
|
[None] No pipeline output.
|
|
|
|
.EXAMPLE
|
|
Invoke-Publish
|
|
#>
|
|
[CmdletBinding()]
|
|
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
|
|
'PSUseConsistentWhitespace',
|
|
'',
|
|
Justification = 'Hashtable bug in ScriptAnalyzer 1.19.1'
|
|
)]
|
|
param ()
|
|
|
|
process {
|
|
$Repo = Get-RepoPath
|
|
$ExpandParams = @{
|
|
Path = $Repo.Bin.ArtifactPath
|
|
DestinationPath = $Repo.Bin.ExpandPath
|
|
Force = $true
|
|
ErrorAction = 'Stop'
|
|
Verbose = $VerbosePreference
|
|
}
|
|
Expand-Archive @ExpandParams
|
|
|
|
$PublishParams = @{
|
|
Repository = 'PSGallery'
|
|
Path = $Repo.Bin.ExpandPath
|
|
NuGetApiKey = $Env:NuGetToken
|
|
Verbose = $VerbosePreference
|
|
ErrorAction = 'Stop'
|
|
}
|
|
Publish-Module @PublishParams
|
|
}
|
|
}
|