ProductivityTools.PSPublishModuleToPowershellGallery.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

function Publish-ModuleToPowerShellGallery {
    [CmdletBinding()]
    param(
        [string]$PSRepositoryApiKey="PSRepositoryApiKey",
        [switch]$IncreaseModuleVersion 
    )
    
    $NuGetApiKey=Get-MasterConfiguration -Key $PSRepositoryApiKey
    
    $repository=Get-PSRepository |where { $_.SourceLocation -eq "https://www.powershellgallery.com/api/v2"}
    $repositoryName=$repository.Name
    Publish-ModuleTo -PSRepository $repositoryName -NuGetApiKey $NuGetApiKey -IncreaseModuleVersion:$IncreaseModuleVersion -Verbose:$VerbosePreference
}

Export-ModuleMember  Publish-ModuleToPowerShellGallery