|
| 1 | +<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Deploy" ToolsVersion="4.0"> |
| 2 | + <PropertyGroup> |
| 3 | + <DeploymentFolder>deployment</DeploymentFolder> |
| 4 | + <PackageName>Shuttle.Core.Threading</PackageName> |
| 5 | + <PackageSource Condition="$(PackageSource) == ''">https://www.nuget.org</PackageSource> |
| 6 | + </PropertyGroup> |
| 7 | + |
| 8 | + <Import Project="Shuttle.MSBuild.targets" /> |
| 9 | + |
| 10 | + <ItemGroup> |
| 11 | + <ProjectReference Include="..\$(PackageName).csproj" /> |
| 12 | + </ItemGroup> |
| 13 | + |
| 14 | + <Target Name="Build"> |
| 15 | + <MSBuild Projects="@(ProjectReference)" Targets="Rebuild" Properties="Configuration=Debug;Platform=AnyCPU"/> |
| 16 | + <MSBuild Projects="@(ProjectReference)" Targets="Rebuild" Properties="Configuration=Release;Platform=AnyCPU"/> |
| 17 | + </Target> |
| 18 | + |
| 19 | + <Target Name="SemanticVersion"> |
| 20 | + <Prompt Text="Enter semantic version:" Condition="$(SemanticVersion) == ''"> |
| 21 | + <Output TaskParameter="UserInput" PropertyName="SemanticVersion" /> |
| 22 | + </Prompt> |
| 23 | + |
| 24 | + <Error Text="Please enter a version number." Condition="$(SemanticVersion) == ''" /> |
| 25 | + |
| 26 | + <ItemGroup> |
| 27 | + <AssemblyInfoFiles Include="..\Properties\AssemblyInfo.cs" /> |
| 28 | + </ItemGroup> |
| 29 | + |
| 30 | + <RegexFindAndReplace Files="@(AssemblyInfoFiles)" FindExpression="AssemblyInformationalVersion\s*\(\s*".*"\s*\)" ReplacementText="AssemblyInformationalVersion("$(SemanticVersion)")" /> |
| 31 | + <RegexFindAndReplace Files="@(AssemblyInfoFiles)" FindExpression="AssemblyVersion\s*\(\s*".*"\s*\)" ReplacementText="AssemblyVersion("$(SemanticVersion).0")" /> |
| 32 | + </Target> |
| 33 | + |
| 34 | + <Target Name="Deploy" DependsOnTargets="SemanticVersion"> |
| 35 | + <MSBuild |
| 36 | + Projects="$(MSBuildProjectFile)" |
| 37 | + Targets="Package" |
| 38 | + Properties="SemanticVersion=$(SemanticVersion)" |
| 39 | + /> |
| 40 | + |
| 41 | + <Exec Command="nuget push $(DeploymentFolder)\nuget\$(PackageName).$(SemanticVersion).nupkg -source $(PackageSource)" /> |
| 42 | + <Exec Command="git commit -a -m "- v$(SemanticVersion)"" /> |
| 43 | + <Exec Command="git push" /> |
| 44 | + </Target> |
| 45 | + |
| 46 | + <Target Name="Package" DependsOnTargets="SemanticVersion;Build"> |
| 47 | + <ItemGroup> |
| 48 | + <NugetBinaries Include="..\bin\debug\**\$(PackageName).dll" /> |
| 49 | + </ItemGroup> |
| 50 | + |
| 51 | + <Copy SourceFiles="package.nuspec" DestinationFolder="$(DeploymentFolder)\nuget\" SkipUnchangedFiles="false" /> |
| 52 | + <Copy SourceFiles="@(NugetBinaries)" DestinationFolder="$(DeploymentFolder)\nuget\lib\%(RecursiveDir)" SkipUnchangedFiles="false" /> |
| 53 | + |
| 54 | + <RegexFindAndReplace Files="$(DeploymentFolder)\nuget\package.nuspec" FindExpression="\{semver\}" ReplacementText="$(SemanticVersion)" /> |
| 55 | + <RegexFindAndReplace Files="$(DeploymentFolder)\nuget\package.nuspec" FindExpression="\{year\}" ReplacementText="$([System.DateTime]::Now.ToString(`yyyy`))" /> |
| 56 | + <SetNugetPackageVersions Files="$(DeploymentFolder)\nuget\package.nuspec" ProjectFile="..\$(PackageName).csproj" /> |
| 57 | + |
| 58 | + <Exec Command="nuget pack $(DeploymentFolder)\nuget\package.nuspec -OutputDirectory $(DeploymentFolder)\nuget -NoPackageAnalysis" /> |
| 59 | + |
| 60 | + <MakeDir Directories="$(NugetPackageSourceFolder)" Condition="$(NugetPackageSourceFolder) != ''" /> |
| 61 | + |
| 62 | + <Copy |
| 63 | + SourceFiles="$(DeploymentFolder)\nuget\$(PackageName).$(SemanticVersion).nupkg" |
| 64 | + DestinationFolder="$(NugetPackageSourceFolder)" |
| 65 | + SkipUnchangedFiles="false" |
| 66 | + Condition="$(NugetPackageSourceFolder) != ''" /> |
| 67 | + </Target> |
| 68 | +</Project> |
0 commit comments