PublishModule.ps1

$ModuleName = "AzureAutomationDebug"
$Tags = "Azure","AzureAutomation"
$ProjectSite = "https://github.com/trondhindenes/AzureAutomationDebug"
$LicenseUri = "https://raw.githubusercontent.com/trondhindenes/AzureAutomationDebug/master/LICENSE.md"

$mod = get-module $ModuleName -list

$GalleryMod = Find-Module -Name $ModuleName

if ($GalleryMod.Version.CompareTo($mod.Version) -eq -1)
{
    "Publishing updated version"
    Publish-Module -Name $ModuleName -RequiredVersion $mod.Version -NuGetApiKey "1e2b296e-2ae0-4852-809e-a5b767b2094a" -ProjectUri $ProjectSite -LicenseUri $LicenseUri
}