-
Notifications
You must be signed in to change notification settings - Fork 5
/
Publish.proj
58 lines (51 loc) · 2.9 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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="Satori.RTM.props" />
<PropertyGroup>
<Configuration>Release</Configuration>
<OutputPath>bin</OutputPath>
<ApiDocProject>sources\Satori.RTM.DocFx\Satori.RTM.DocFx.csproj</ApiDocProject>
<GitRepo>[email protected]:satori-com/satori-rtm-sdk-csharp.git</GitRepo>
<NugetProject>sources\Satori.RTM.Nuget\Satori.RTM.Nuget.csproj</NugetProject>
<NugetFile>Satori.RTM.SDK.$(SatoriSdkVersion).nupkg</NugetFile>
<NugetPath>sources\Satori.RTM.Nuget\bin\$(Configuration)\$(NugetFile)</NugetPath>
</PropertyGroup>
<Target Name="Build" DependsOnTargets="CreateDirectories">
<Error Condition=" '$(OS)' == 'Unix' " Text="Publishing works on Windows only" />
<Message Text="Available targets: /t:PublishApiDoc" />
</Target>
<Target Name="CreateDirectories" DependsOnTargets="RemoveDirectories">
<MakeDir Directories="$(OutputPath)" />
</Target>
<Target Name="RemoveDirectories">
<RemoveDir Directories="$(OutputPath)" />
</Target>
<Target Name="BuildApiDoc" DependsOnTargets="Build">
<MSBuild Projects="$(ApiDocProject)" Targets="Build"
Properties="Configuration=$(Configuration)" BuildInParallel="true"/>
</Target>
<Target Name="ServeApiDoc" DependsOnTargets="Build">
<!-- Build API doc and make it available at http://localhost -->
<MSBuild Projects="$(ApiDocProject)" Targets="Serve"
Properties="Configuration=$(Configuration)" BuildInParallel="true"/>
</Target>
<Target Name="PublishApiDoc" DependsOnTargets="BuildApiDoc">
<Exec Command="git clone $(GitRepo) -b gh-pages --single-branch" WorkingDirectory="$(OutputPath)" />
<Exec Command="git rm -rf ." WorkingDirectory="$(OutputPath)\satori-rtm-sdk-csharp" />
<ItemGroup>
<ApiDocFiles Include="sources\Satori.RTM.DocFx\bin\_site\**\*.*"/>
</ItemGroup>
<Copy SourceFiles="@(ApiDocFiles)"
DestinationFiles="@(ApiDocFiles->'$(OutputPath)\satori-rtm-sdk-csharp\%(RecursiveDir)%(Filename)%(Extension)')" />
<Exec Command="git add --all" WorkingDirectory="$(OutputPath)\satori-rtm-sdk-csharp" />
<Exec Command="git commit -m "Update API Doc"" WorkingDirectory="$(OutputPath)\satori-rtm-sdk-csharp" />
<Exec Command="git push" WorkingDirectory="$(OutputPath)\satori-rtm-sdk-csharp" />
</Target>
<Target Name="BuildNuget" DependsOnTargets="Build">
<MsBuild Projects="$(NugetProject)" Targets="Build"
Properties="Configuration=$(Configuration)" BuildInParallel="true"/>
<Copy SourceFiles="$(NugetPath)"
DestinationFiles="$(OutputPath)\$(NugetFile)" />
</Target>
</Project>