@@ -16,8 +16,10 @@ param(
16
16
[Parameter (Mandatory = $false , Position = 0 )]
17
17
[string ] $buildConfig ,
18
18
[Parameter (Mandatory = $false , Position = 1 )]
19
- [string ] $apiKey ,
19
+ [string ] $scope ,
20
20
[Parameter (Mandatory = $false , Position = 2 )]
21
+ [string ] $apiKey ,
22
+ [Parameter (Mandatory = $false , Position = 3 )]
21
23
[string ] $repositoryLocation
22
24
)
23
25
@@ -29,11 +31,17 @@ if ([string]::IsNullOrEmpty($buildConfig))
29
31
30
32
if ([string ]::IsNullOrEmpty($repositoryLocation ))
31
33
{
32
- Write-Verbose " Setting repository location to 'https://dtlgalleryint.cloudapp.net/api/v2'"
33
-
34
+ Write-Verbose " Setting repository location to 'https://dtlgalleryint.cloudapp.net/api/v2'"
34
35
$repositoryLocation = " https://dtlgalleryint.cloudapp.net/api/v2"
35
36
}
36
37
38
+ if ([string ]::IsNullOrEmpty($scope ))
39
+ {
40
+ Write-Verbose " Default scope to all"
41
+ $scope = ' all'
42
+ }
43
+
44
+ Write-Host " Publishing $scope package(s)"
37
45
38
46
$packageFolder = " $PSScriptRoot \..\src\Package"
39
47
@@ -44,27 +52,39 @@ if ($repo -ne $null) {
44
52
$repoName = $ (New-Guid ).ToString()
45
53
Register-PSRepository - Name $repoName - SourceLocation $repositoryLocation - PublishLocation $repositoryLocation / package - InstallationPolicy Trusted
46
54
}
47
- $modulePath = " $packageFolder \$buildConfig \ServiceManagement\Azure"
48
- # Publish Azure module
49
- Write-Host " Publishing Azure module from $modulePath "
50
- Publish-Module - Path $modulePath - NuGetApiKey $apiKey - Repository $repoName - Tags (" Azure" , " AzureRM" )
51
- # Publish AzureRM module
52
- $modulePath = " $PSScriptRoot \AzureRM"
53
- Write-Host " Publishing AzureRM module from $modulePath "
54
- Publish-Module - Path $modulePath - NuGetApiKey $apiKey - Repository $repoName - Tags (" Azure" , " AzureRM" )
55
- Write-Host " Published Azure module"
56
- # Publish AzureRM.Profile module
57
- Write-Host " Publishing AzureRM.Profile module from $modulePath "
58
- Publish-Module - Path " $packageFolder \$buildConfig \ResourceManager\AzureResourceManager\AzureRM.Profile" - NuGetApiKey $apiKey - Repository $repoName
59
- Write-Host " Published AzureRM.Profile module"
60
55
61
- # Publish AzureRM modules
62
- $resourceManagerModules = Get-ChildItem - Path " $packageFolder \$buildConfig \ResourceManager\AzureResourceManager" - Directory
63
- foreach ($module in $resourceManagerModules ) {
64
- if ($module -ne " AzureRM.Profile" ) {
56
+ if (($scope -eq ' all' ) -or ($scope -eq ' servicemanagement' )) {
57
+ $modulePath = " $packageFolder \$buildConfig \ServiceManagement\Azure"
58
+ # Publish Azure module
59
+ Write-Host " Publishing Azure module from $modulePath "
60
+ Publish-Module - Path $modulePath - NuGetApiKey $apiKey - Repository $repoName
61
+ }
62
+
63
+ if ($scope -eq ' AzureRM' ) {
64
+ # Publish AzureRM module
65
+ $modulePath = " $PSScriptRoot \AzureRM"
66
+ Write-Host " Publishing AzureRM module from $modulePath "
67
+ Publish-Module - Path $modulePath - NuGetApiKey $apiKey - Repository $repoName
68
+ Write-Host " Published Azure module"
69
+ }
70
+
71
+ $resourceManagerRootFolder = " $packageFolder \$buildConfig \ResourceManager\AzureResourceManager"
72
+ $resourceManagerModules = Get-ChildItem - Path $resourceManagerRootFolder - Directory
73
+ if ($scope -eq ' all' ) {
74
+ # Publish AzureRM modules
75
+ foreach ($module in $resourceManagerModules ) {
65
76
$modulePath = $module.FullName
66
77
Write-Host " Publishing $module module from $modulePath "
67
- Publish-Module - Path $modulePath - NuGetApiKey $apiKey - Repository $repoName - Tags ( " Azure " , " AzureRM " )
78
+ Publish-Module - Path $modulePath - NuGetApiKey $apiKey - Repository $repoName
68
79
Write-Host " Published $module module"
69
80
}
81
+ } else {
82
+ $modulePath = Join-Path $resourceManagerRootFolder " AzureRM.$scope "
83
+ if (Test-Path $modulePath ) {
84
+ Write-Host " Publishing $scope module from $modulePath "
85
+ Publish-Module - Path $modulePath - NuGetApiKey $apiKey - Repository $repoName
86
+ Write-Host " Published $scope module"
87
+ } else {
88
+ Write-Error " Can not find module with name $scope to publish"
89
+ }
70
90
}
0 commit comments