PublishModulesPPE.ps1
# ---------------------------------------------------------------------------------- # # Copyright Microsoft Corporation # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ---------------------------------------------------------------------------------- param( [Parameter(Mandatory = $false, Position = 0)] [string] $buildConfig, [Parameter(Mandatory = $false, Position = 1)] [string] $scope, [Parameter(Mandatory = $false, Position = 2)] [string] $apiKey, [Parameter(Mandatory = $false, Position = 3)] [string] $repositoryLocation ) if ([string]::IsNullOrEmpty($buildConfig)) { Write-Verbose "Setting build configuration to 'Release'" $buildConfig = "Release" } if ([string]::IsNullOrEmpty($repositoryLocation)) { Write-Verbose "Setting repository location to 'https://dtlgalleryint.cloudapp.net/api/v2/'" $repositoryLocation = "https://dtlgalleryint.cloudapp.net/api/v2/" } if ([string]::IsNullOrEmpty($scope)) { Write-Verbose "Default scope to all" $scope = 'All' } Write-Host "Publishing $scope package(and its dependencies)" $packageFolder = "$PSScriptRoot" $repo = Get-PSRepository | where { $_.SourceLocation -eq $repositoryLocation } if ($repo -ne $null) { $repoName = $repo.Name } else { $repoName = $(New-Guid).ToString() Register-PSRepository -Name $repoName -SourceLocation $repositoryLocation -PublishLocation $repositoryLocation/package -InstallationPolicy Trusted } $resourceManagerRootFolder = "$packageFolder" $publishToLocal = test-path $repositoryLocation if (($scope -eq 'All') -or $publishToLocal ) { # If we publish 'All' or to local folder, publish AzureActiveDirectory first, becasue it is the common dependency Write-Host "Publishing profile module" Publish-Module -Name "$resourceManagerRootFolder\AzureAD.psd1" -NuGetApiKey $apiKey -Repository $repoName -Tags ("Azure") -LicenseUri "http://aka.ms/azps-license" Write-Host "Published active directory module" } |