Only attempt to publish npm when npm artifacts exist
This commit is contained in:
parent
2b6989bc09
commit
8fbac32ed8
|
|
@ -1,35 +1,32 @@
|
||||||
<Project>
|
<Project>
|
||||||
<Target Name="Push" DependsOnTargets="_PushNuGet;_PushNpm" />
|
<Target Name="Push" DependsOnTargets="_PushNuGet;_PushNpm" />
|
||||||
|
|
||||||
<Target Name="_PushNuGet">
|
<ItemGroup>
|
||||||
|
<PackagesToPush Include="$(BuildDir)*.nupkg" />
|
||||||
|
<PackagesToPush Include="$(ArtifactsDir)mirror\*.nupkg" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="_PushNuGet" Condition="@(PackagesToPush->Count()) != 0">
|
||||||
<Error Text="Missing required property: NuGetPublishFeed" Condition=" '$(NuGetPublishFeed)' == '' "/>
|
<Error Text="Missing required property: NuGetPublishFeed" Condition=" '$(NuGetPublishFeed)' == '' "/>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<_PackagesToPush Include="$(BuildDir)*.nupkg" />
|
|
||||||
<_PackagesToPush Include="$(ArtifactsDir)mirror\*.nupkg" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<PushNuGetPackages
|
<PushNuGetPackages
|
||||||
Packages="@(_PackagesToPush)"
|
Packages="@(PackagesToPush)"
|
||||||
Feed="$(NuGetPublishFeed)"
|
Feed="$(NuGetPublishFeed)"
|
||||||
Condition="@(_PackagesToPush->Count()) != 0"
|
|
||||||
ApiKey="$(APIKey)" />
|
ApiKey="$(APIKey)" />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="_PushNpm">
|
<ItemGroup>
|
||||||
|
<NpmModuleArtifact Include="$(BuildDir)*.tgz" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="_PushNpm" Condition="@(NpmModuleArtifact->Count()) != 0">
|
||||||
<Error Text="Missing required property: NpmRegistry" Condition=" '$(NpmRegistry)' == '' "/>
|
<Error Text="Missing required property: NpmRegistry" Condition=" '$(NpmRegistry)' == '' "/>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<AuthTokenSetting>$(NpmRegistry.Replace("https:", "")):_authToken</AuthTokenSetting>
|
<AuthTokenSetting>$(NpmRegistry.Replace("https:", "")):_authToken</AuthTokenSetting>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<NpmModuleArtifact Include="$(BuildDir)*.tgz" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<Exec Command="npm config set "$(AuthTokenSetting)" $(APIKey)" Condition=" '$(APIKey)' != '' " />
|
<Exec Command="npm config set "$(AuthTokenSetting)" $(APIKey)" Condition=" '$(APIKey)' != '' " />
|
||||||
<Exec Command="npm publish --registry $(NpmRegistry) "%(NpmModuleArtifact.Identity)""
|
<Exec Command="npm publish --registry $(NpmRegistry) "%(NpmModuleArtifact.Identity)""
|
||||||
Condition="@(NpmModuleArtifact->Count()) != 0"
|
|
||||||
ContinueOnError="true">
|
ContinueOnError="true">
|
||||||
<Output TaskParameter="ExitCode" ItemName="ExitCodes" />
|
<Output TaskParameter="ExitCode" ItemName="ExitCodes" />
|
||||||
</Exec>
|
</Exec>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue