Skip to content

Commit

Permalink
fix publish modules
Browse files Browse the repository at this point in the history
  • Loading branch information
Nickcandy committed Feb 8, 2024
1 parent 41a7993 commit 6d264a1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
6 changes: 5 additions & 1 deletion build.proj
Expand Up @@ -44,6 +44,10 @@
<!-- Flags -->
<CodeSign Condition ="'$(CodeSign)' == ''">false</CodeSign>
<SkipHelp Condition ="'$(SkipHelp)' != 'true'">false</SkipHelp>
<TargetBuild Condition="Exists($(TargetModule))">true</TargetBuild>
<TargetBuild Condition="!Exists($(TargetModule))">false</TargetBuild>


<!-- Set this true only if you want to test the CodeSign workflow locally -->
<DelaySign Condition ="'$(DelaySign)' == ''">false</DelaySign>
<NetCore Condition="'$(NetCore)' != 'false'">true</NetCore>
Expand Down Expand Up @@ -262,7 +266,7 @@
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(RepoTools)/CleanupBuild.ps1 -BuildConfig $(Configuration) -GenerateDocumentationFile $(GenerateDocumentationFile) &quot;" />

<Error Condition="'$(NuGetKey)' == ''" Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(RepoTools)/PublishModules.ps1 -IsNetCore:$$(NetCore) -BuildConfig $(Configuration) -Scope $(Scope) -ApiKey $(NuGetKey) -RepositoryLocation \&quot;$(NuGetPublishingSource)\&quot;&quot; -NugetExe $(NuGetCommand)" />
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(RepoTools)/PublishModules.ps1 -TargetBuild $(TargetBuild) -IsNetCore:$$(NetCore) -BuildConfig $(Configuration) -Scope $(Scope) -ApiKey $(NuGetKey) -RepositoryLocation \&quot;$(NuGetPublishingSource)\&quot;&quot; -NugetExe $(NuGetCommand)" />
</Target>

<Target Name="BuildInstaller" AfterTargets="Publish" Condition="('$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore')">
Expand Down
7 changes: 5 additions & 2 deletions tools/PublishModules.ps1
Expand Up @@ -56,7 +56,10 @@ param(
[string]$RepositoryLocation,

[Parameter(Mandatory = $false, Position = 5)]
[string]$NugetExe
[string]$NugetExe,

[Parameter(Mandatory = $false, Position = 6)]
[string]$TargetBuild
)

Import-Module "$PSScriptRoot\PublishModules.psm1"
Expand Down Expand Up @@ -117,7 +120,7 @@ $env:PSModulePath = "$env:PSModulePath;$tempRepoPath"
$Errors = $null

try {
$modules = Get-AllModules -BuildConfig $BuildConfig -Scope $Scope -PublishLocal:$PublishLocal -IsNetCore:$IsNetCore
$modules = Get-AllModules -BuildConfig $BuildConfig -Scope $Scope -TargetBuild $TargetBuild -PublishLocal:$PublishLocal -IsNetCore:$IsNetCore
Add-AllModules -ModulePaths $modules -TempRepo $tempRepoName -TempRepoPath $tempRepoPath -NugetExe $NugetExe
Publish-AllModules -ModulePaths $modules -ApiKey $apiKey -TempRepoPath $tempRepoPath -RepoLocation $repositoryLocation -NugetExe $NugetExe -PublishLocal:$PublishLocal
} catch {
Expand Down
4 changes: 3 additions & 1 deletion tools/PublishModules.psm1
Expand Up @@ -267,6 +267,8 @@ function Get-AllModules {
[ValidateNotNullOrEmpty()]
[String]$Scope,

[String]$TargetBuild,

[switch]$PublishLocal,

[switch]$IsNetCore
Expand All @@ -275,7 +277,7 @@ function Get-AllModules {
$clientModules = Get-ClientModules -BuildConfig $BuildConfig -Scope $Scope -PublishLocal:$PublishLocal -IsNetCore:$isNetCore
Write-Host " "

if($clientModules.Length -le 2) {
if($clientModules.Length -le 2 -and $TargetBuild -eq "true") {
return @{
ClientModules = $clientModules
}
Expand Down

0 comments on commit 6d264a1

Please sign in to comment.