Universe/build/push.targets

47 строки
1.7 KiB
XML

<Project>
<Target Name="Push" DependsOnTargets="_PushNuGet;_PushNpm" />
<Target Name="_PushNuGet">
<Error Text="Missing required property: NuGetPublishFeed" Condition=" '$(NuGetPublishFeed)' == '' "/>
<ItemGroup>
<_PackagesToPush Include="$(BuildDir)*.nupkg" />
<_PackagesToPush Include="$(ArtifactsDir)mirror\*.nupkg" />
<_LineupPackagesToPush Include="$(LineupBuildDir)*.nupkg" />
</ItemGroup>
<PushNuGetPackages
Packages="@(_PackagesToPush)"
Feed="$(NuGetPublishFeed)"
Condition="@(_PackagesToPush->Count()) != 0"
ApiKey="$(APIKey)" />
<PushNuGetPackages
Packages="@(_LineupPackagesToPush)"
Feed="$(NuGetPublishFeed)"
Condition="@(_LineupPackagesToPush->Count()) != 0"
ApiKey="$(APIKey)" />
</Target>
<Target Name="_PushNpm">
<Error Text="Missing required property: NpmRegistry" Condition=" '$(NpmRegistry)' == '' "/>
<PropertyGroup>
<AuthTokenSetting>$(NpmRegistry.Replace("https:", "")):_authToken</AuthTokenSetting>
</PropertyGroup>
<ItemGroup>
<NpmModuleArtifact Include="$(BuildDir)*.tgz" />
</ItemGroup>
<Exec Command="npm config set &quot;$(AuthTokenSetting)&quot; $(APIKey)" Condition=" '$(APIKey)' != '' " />
<Exec Command="npm publish --registry $(NpmRegistry) &quot;%(NpmModuleArtifact.Identity)&quot;"
Condition="@(NpmModuleArtifact->Count()) != 0"
ContinueOnError="true">
<Output TaskParameter="ExitCode" ItemName="ExitCodes" />
</Exec>
<Exec Command="npm config delete $(AuthTokenSetting)" Condition=" '$(APIKey)' != '' "/>
<Error Text="Publishing npm modules failed" Condition="%(ExitCodes.Identity) > 0"/>
</Target>
</Project>