-
Notifications
You must be signed in to change notification settings - Fork 87
/
Release.proj
60 lines (47 loc) · 2.31 KB
/
Release.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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Appveyor variables -->
<PropertyGroup>
<PackageVersion Condition="'$(APPVEYOR_BUILD_VERSION)' != '' And '$(PackageVersion)' == ''">$(APPVEYOR_BUILD_VERSION)</PackageVersion>
<PackageVersionSuffix Condition="'$(APPVEYOR)' == 'True'">pre</PackageVersionSuffix>
</PropertyGroup>
<PropertyGroup>
<FullPackageVersion>$(PackageVersion)</FullPackageVersion>
<FullPackageVersion Condition="'$(PackageVersionSuffix)' != ''">$(FullPackageVersion)-$(PackageVersionSuffix)</FullPackageVersion>
</PropertyGroup>
<Target Name="WriteAssemblyVersionInfo">
<Error Condition="'$(PackageVersion)' == ''"
Text="PackageVersion must be specified $(APPVEYOR_BUILD_VERSION)" />
<ItemGroup>
<AssemblyVersionLines
Include="[assembly: System.Reflection.AssemblyVersion("$(PackageVersion)")]" />
<AssemblyVersionLines
Include="[assembly: System.Reflection.AssemblyFileVersion("$(FullPackageVersion)")]" />
</ItemGroup>
<WriteLinesToFile File="AssemblyVersionInfo.cs" Lines="@(AssemblyVersionLines)" Overwrite="true" />
</Target>
<Target Name="PatchNuspecVersion">
<XmlPoke
XmlInputPath="RichardSzalay.MockHttp.nuspec"
Query="/package/metadata/version"
Value="$(FullPackageVersion)"
/>
</Target>
<Target Name="PatchVersion" DependsOnTargets="WriteAssemblyVersionInfo;PatchNuspecVersion">
</Target>
<Target Name="Restore">
<MSBuild Projects="RichardSzalay.MockHttp.sln" Targets="Restore" Properties="Configuration=Release;Platform=Any CPU" />
</Target>
<Target Name="Build" DependsOnTargets="PatchVersion;Restore">
<MSBuild Projects="RichardSzalay.MockHttp.sln" Properties="Configuration=Release;Platform=Any CPU" />
</Target>
<Target Name="Package" DependsOnTargets="Build">
<Exec Command="dotnet pack --no-build -c Release -o . RichardSzalay.MockHttp.NetStandard\RichardSzalay.MockHttp.NetStandard.csproj" />
</Target>
<Target Name="Push" DependsOnTargets="Package">
<ItemGroup>
<NuSpecFiles Include="*.nuspec" />
</ItemGroup>
<Exec Command="dotnet nuget push @(NuSpecFiles->'%(Filename)').$(FullPackageVersion).nupkg --source nuget.org -k $(NuGetApiKey)" />
</Target>
</Project>