diff --git a/.gitignore b/.gitignore index 4ac9d8d..dbab1a0 100644 --- a/.gitignore +++ b/.gitignore @@ -48,4 +48,5 @@ $RECYCLE.BIN/ .AppleDesktop Network Trash Folder Temporary Items -.apdisk \ No newline at end of file +.apdisk +/Modules/VMware.vSphere.SsoAdmin/ForPSGallery/VMware.vSphere.SsoAdmin diff --git a/Modules/VMware.vSphere.SsoAdmin/src/build.ps1 b/Modules/VMware.vSphere.SsoAdmin/src/build.ps1 index 4ad378b..3f53a22 100644 --- a/Modules/VMware.vSphere.SsoAdmin/src/build.ps1 +++ b/Modules/VMware.vSphere.SsoAdmin/src/build.ps1 @@ -3,10 +3,6 @@ # ************************************************************************** param( - [ValidateSet("Debug", "Release")] - [string] - $Configuration = "Release", - [string] $TestVc, @@ -14,9 +10,14 @@ param( $TestVcUser, [string] - $TestVcPassword + $TestVcPassword, + + [switch] + $PrepareForPSGallery ) +$Configuration = "Release" + function Test-BuildToolsAreAvailable { $dotnetSdk = Get-Command 'dotnet' if (-not $dotnetSdk) { @@ -130,6 +131,25 @@ function Test { } } +function PrepareForRelease { + $targetRootDirName = 'ForPSGallery' + $releaseDir = Join-Path (Split-Path $PSScriptRoot) $targetRootDirName + if (Test-Path $releaseDir) { + Remove-Item -Path $releaseDir -Recurse + } + + New-Item -Path $releaseDir -ItemType Directory | Out-Null + $releaseDir = Join-Path $releaseDir 'VMware.vSphere.SsoAdmin' + New-Item -Path $releaseDir -ItemType Directory | Out-Null + + $sourceDir = Split-Path $PSScriptRoot + Get-ChildItem -Path $sourceDir -Exclude src, README.md, $targetRootDirName | ` + Copy-Item -Recurse -Destination $releaseDir + + $catalogFilePath = Join-path $releaseDir ((Get-Item $releaseDir).Name + ".cat") + New-FileCatalog -Path $releaseDir -CatalogFilePath $catalogFilePath | Out-Null +} + # 1. Test Build Tools LogInfo "Test build tools are available" Test-BuildToolsAreAvailable @@ -144,4 +164,9 @@ LogInfo "Publish binaries to '$OutputFolder'" Publish $OutputFolder # 4. Test -Test \ No newline at end of file +Test + +# 5. Prepare For Release +if ($PrepareForPSGallery) { + PrepareForRelease +} \ No newline at end of file