forked from dotnet/machinelearning
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpublish.proj
69 lines (55 loc) · 3.44 KB
/
publish.proj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<Project>
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
<UsingTask TaskName="ExecWithRetriesForNuGetPush" AssemblyFile="$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll" />
<PropertyGroup>
<PublishSymbolsPackage>Microsoft.SymbolUploader.Build.Task</PublishSymbolsPackage>
<EnablePublishSymbols Condition="'$(EnablePublishSymbols)'==''" >true</EnablePublishSymbols>
<NuGetPushTimeoutSeconds Condition="'$(NuGetPushTimeoutSeconds)' == ''">600</NuGetPushTimeoutSeconds>
</PropertyGroup>
<Import Project="$(PackagesDir)\$(PublishSymbolsPackage.ToLower())\$(PublishSymbolsPackageVersion)\build\PublishSymbols.targets" />
<Target Name="PublishPackages">
<Error Condition="'$(NuGetFeedUrl)' == ''" Text="Missing required property NuGetFeedUrl" />
<Error Condition="'$(NuGetApiKey)' == ''" Text="Missing required property NuGetApiKey" />
<ItemGroup>
<NuGetPackages Include="$(PackageOutputPath)**\*.nupkg"
Exclude="$(PackageOutputPath)**\*.symbols.*nupkg" />
<!--
IgnorableErrorMessages applies to the "ExectWithRetriesForNuGetPush" task.
There's a very special failure scenario that we want to ignore. That scenario is
when NuGet hits a timeout on one "push" attempt, and then gets a "Forbidden" response
because the package "already exists" on the next response. This indicates that the
timeout occurred, but the push was actually successful.
-->
<IgnorableErrorMessages Include="Overwriting existing packages is forbidden according to the package retention settings for this feed.">
<ConditionalErrorMessage>Pushing took too long</ConditionalErrorMessage>
</IgnorableErrorMessages>
</ItemGroup>
<Message Text="Pushing ML.NET packages to $(NuGetFeedUrl)" />
<PropertyGroup>
<DotnetToolCommand>$(ToolsDir)dotnetcli/dotnet</DotnetToolCommand>
<NuGetPushCommand>$(DotnetToolCommand) nuget push --source $(NuGetFeedUrl) --api-key $(NuGetApiKey) --timeout $(NuGetPushTimeoutSeconds)</NuGetPushCommand>
</PropertyGroup>
<ExecWithRetriesForNuGetPush Command="$(NuGetPushCommand) %(NuGetPackages.Identity)"
IgnoredErrorMessagesWithConditional="@(IgnorableErrorMessages)" />
</Target>
<Target Name="PublishSymbolPackages"
Condition="'$(EnablePublishSymbols)'=='true'"
DependsOnTargets="SetupPublishSymbols">
<Message Text="Attempting to Publish Symbols" />
<Error Condition="!Exists('$(PackageOutputPath)')" Text="'PackageOutputPath' folder '$(PackageOutputPath)' does not exist."/>
<Error Condition="'$(SymbolServerPath)'==''" Text="Missing property SymbolServerPath" />
<Error Condition="'$(SymbolServerPAT)'==''" Text="Missing property SymbolServerPAT" />
<CallTarget Targets="PublishSymbols" />
</Target>
<Target Name="SetupPublishSymbols">
<PropertyGroup>
<SymbolExpirationInDays Condition="'$(SymbolExpirationInDays)'=='' and '$(SymbolExpirationDate)'==''">180</SymbolExpirationInDays>
<ConvertPortablePdbsToWindowsPdbs>true</ConvertPortablePdbsToWindowsPdbs>
</PropertyGroup>
<ItemGroup>
<SymbolPackagesToPublish Include="$(PackageOutputPath)**\*.symbols.*nupkg" />
</ItemGroup>
<Message Importance="High" Text="Publishing @(SymbolPackagesToPublish) to $(SymbolServerPath)"/>
<Error Condition="'@(SymbolPackagesToPublish)'==''" Text="There are no symbol nuget packages to publish" />
</Target>
</Project>