From 13c64719563f098029bfc53069cb4315dc732d19 Mon Sep 17 00:00:00 2001 From: Beisi Zhou Date: Wed, 7 Sep 2022 18:13:07 +0800 Subject: [PATCH] Added ArtifactsOutputPath as one of PSModulePath (#19425) * Added ArtifactsOutputPath as PSModulePath * Refactor scripts * Update RunVersionController.ps1 --- tools/RunVersionController.ps1 | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/tools/RunVersionController.ps1 b/tools/RunVersionController.ps1 index 1cf1d464e2ff..b9758f662a32 100644 --- a/tools/RunVersionController.ps1 +++ b/tools/RunVersionController.ps1 @@ -18,7 +18,10 @@ Param( [string]$ModuleName, [Parameter()] - [string]$GalleryName = "PSGallery" + [string]$GalleryName = "PSGallery", + + [Parameter()] + [string]$ArtifactsOutputPath = "$PSScriptRoot/../artifacts/Release/" ) enum PSVersion @@ -275,7 +278,20 @@ function Bump-AzVersion $changeLog += "#### $updatedModule" $changeLog += $(Get-ReleaseNotes -Module $updatedModule -RootPath $rootPath) + "`n" } - + + $resolvedArtifactsOutputPath = (Resolve-Path $ArtifactsOutputPath).Path + if(!(Test-Path $resolvedArtifactsOutputPath)) + { + throw "Please check artifacts output path: $resolvedArtifactsOutputPath whether exists." + } + + # Update-ModuleManifest requires all required modules in Az.psd1 installed in local + # Add artifacts as PSModulePath to skip installation + if(!($env:PSModulePath.Split(";").Contains($resolvedArtifactsOutputPath))) + { + $env:PSModulePath += ";$resolvedArtifactsOutputPath" + } + Update-ModuleManifest -Path "$PSScriptRoot\Az\Az.psd1" -ModuleVersion $newVersion -ReleaseNotes $releaseNotes Update-ChangeLog -Content $changeLog -RootPath $rootPath return $versionBump