Productivity Tools

Tools written by an IT business manager, a passionate developer.

Publish module to

Module helps to publish module to PowerShell gallery for binary and script modules.

Publishing module to PowerShell gallery is very straight-forward task. To do it we just need to invoke command

Publish-Module -NuGetApiKey $nuGetApiKey -Name $fullPath

If we are pushing to different repository than default, we also can provide PSRepostiory parameter

Publish-Module -PSRepository $psRepository -NuGetApiKey $nuGetApiKey -Name $fullPath

As I am publishing a lot I automated this repeatable task. Described module allows to be invoked in the directory of the module without pointing out exact psd1 file. Cmdlet will find it and process.

If a target module is binary one it will rebuild application and publish the newest version.

Also the Publish-ModuleTo allows to use UpdateModuleVersion switch, which will increase patch number (z in X.Y.Z).

This module is base for other, more specific one. Please check out Publish-ModuleToPowershellGallery


Go to the directory of the module and invoke

Publish-ModuleTo -PSRepository PSGallery -NuGetApiKey $nuGetApiKey   Publish-ModuleTo -PSRepository PSGallery -NuGetApiKey $nuGetApiKey  -Verbose -IncreaseModuleVersion