Public/Utilities/Publish-JyskITAutomation.ps1
function Publish-JyskITAutomation() { try { $PSGalleryKey = Get-PSGalleryKey } catch { Write-Error "Failed to retreive PSGallery key from Azure Key Vault: $_" } # Remove logs and cache folder Write-Host "Removing logs and cache folder" -ForegroundColor Yellow if(Test-Path (Join-Path $script:ModuleRoot "cache")) { Join-Path $script:ModuleRoot "cache" | Remove-Item -Recurse -Force } if(Test-Path (Join-Path $script:ModuleRoot "logs")) { Join-Path $script:ModuleRoot "logs" | Remove-Item -Recurse -Force } Write-Host "Please make sure you have updated the version number in the module manifest. (JyskIT.Automation.psd1)" -ForegroundColor Yellow $Response = Read-Host "Are you sure you want to publish the module to PSGallery? [Y/N]" if ($Response.ToLower() -ne 'y') { return } Publish-Module -Path $script:ModuleRoot -NuGetApiKey $PSGalleryKey } |