diff --git a/build/Build.csproj b/build/Build.csproj index fff5da4..fb97f98 100644 --- a/build/Build.csproj +++ b/build/Build.csproj @@ -6,7 +6,7 @@ - + diff --git a/build/Context.cs b/build/Context.cs index 2872f06..c2c9b9b 100644 --- a/build/Context.cs +++ b/build/Context.cs @@ -1,3 +1,4 @@ +using Cake.Common.Build; using Cake.Common.Tools.DotNetCore.MSBuild; using Cake.Core; using Cake.Core.IO; @@ -24,6 +25,8 @@ public class Context : FrostingContext public bool AppVeyor { get; set; } + public BuildSystem BuildSystem { get; set; } + public Context(ICakeContext context) : base(context) { diff --git a/build/Lifetime.cs b/build/Lifetime.cs index 64e4269..332bcf1 100644 --- a/build/Lifetime.cs +++ b/build/Lifetime.cs @@ -29,10 +29,11 @@ public override void Setup(Context context) context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("cake-build/frosting", buildSystem.AppVeyor.Environment.Repository.Name); context.IsTagged = IsBuildTagged(buildSystem); context.IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals("master", buildSystem.AppVeyor.Environment.Repository.Branch); + context.BuildSystem = buildSystem; // Install tools context.Information("Installing tools..."); - ToolInstaller.Install(context, "GitVersion.CommandLine", "3.6.2"); + ToolInstaller.Install(context, "GitVersion.CommandLine", "3.6.5"); // Calculate semantic version. context.Version = BuildVersion.Calculate(context); diff --git a/build/Tasks/AppVeyor.cs b/build/Tasks/AppVeyor.cs index 67ab259..7020728 100644 --- a/build/Tasks/AppVeyor.cs +++ b/build/Tasks/AppVeyor.cs @@ -1,5 +1,6 @@ using Cake.Frosting; +[Dependency(typeof(AppVeyorArtifacts))] [Dependency(typeof(PublishMyGet))] public class AppVeyor : FrostingTask { diff --git a/build/Tasks/AppVeyorArtifacts.cs b/build/Tasks/AppVeyorArtifacts.cs new file mode 100644 index 0000000..57dcdac --- /dev/null +++ b/build/Tasks/AppVeyorArtifacts.cs @@ -0,0 +1,34 @@ +using Cake.Common.Tools.NuGet; +using Cake.Common.Tools.NuGet.Push; +using Cake.Core; +using Cake.Core.IO; +using Cake.Frosting; + +[Dependency(typeof(Package))] +public class AppVeyorArtifacts : FrostingTask +{ + public override bool ShouldRun(Context context) + { + return context.AppVeyor; + } + + public override void Run(Context context) + { + // Get the file paths. + var root = new DirectoryPath("./src/Cake.Frosting"); + var files = new[] { + $"./artifacts/Cake.Frosting.Template.{context.Version.SemVersion}.nupkg", + $"./artifacts/Cake.Frosting.{context.Version.SemVersion}.nupkg", + $"./artifacts/Cake.Frosting.{context.Version.SemVersion}.symbols.nupkg" + }; + + + // Push files + foreach(var file in files) + { + context.BuildSystem.AppVeyor.UploadArtifact( + file + ); + } + } +} \ No newline at end of file diff --git a/build/Tasks/PackageTemplate.cs b/build/Tasks/PackageTemplate.cs index 612da9a..6ca53d8 100644 --- a/build/Tasks/PackageTemplate.cs +++ b/build/Tasks/PackageTemplate.cs @@ -8,11 +8,14 @@ public class PackageTemplate : FrostingTask { public override void Run(Context context) { - context.XmlPoke( - "./template/Build.csproj", - "/Project/ItemGroup/PackageReference[@Include = 'Cake.Frosting']/@Version", - context.Version.SemVersion - ); + if (context.AppVeyor) + { + context.XmlPoke( + "./template/Build.csproj", + "/Project/ItemGroup/PackageReference[@Include = 'Cake.Frosting']/@Version", + context.Version.SemVersion + ); + } context.NuGetPack("./template/Cake.Frosting.Template.nuspec", new NuGetPackSettings { diff --git a/build/Tasks/PublishMyGet.cs b/build/Tasks/PublishMyGet.cs index 8587baf..7b382d7 100644 --- a/build/Tasks/PublishMyGet.cs +++ b/build/Tasks/PublishMyGet.cs @@ -5,6 +5,7 @@ using Cake.Frosting; [Dependency(typeof(Package))] +[Dependency(typeof(AppVeyorArtifacts))] public class PublishMyGet : FrostingTask { public override bool ShouldRun(Context context) diff --git a/build/Tasks/Restore.cs b/build/Tasks/Restore.cs index bd36079..4b9ce94 100644 --- a/build/Tasks/Restore.cs +++ b/build/Tasks/Restore.cs @@ -11,9 +11,6 @@ public override void Run(Context context) { MSBuildSettings = context.MSBuildSettings, Sources = new [] { - "https://www.myget.org/F/xunit/api/v3/index.json", - "https://dotnet.myget.org/F/dotnet-core/api/v3/index.json", - "https://dotnet.myget.org/F/cli-deps/api/v3/index.json", "https://api.nuget.org/v3/index.json", "https://www.myget.org/F/cake/api/v3/index.json" } diff --git a/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj b/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj index ff0ca2f..f64bed7 100644 --- a/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj +++ b/src/Cake.Frosting.Tests/Cake.Frosting.Tests.csproj @@ -26,7 +26,7 @@ - + diff --git a/src/Cake.Frosting/Cake.Frosting.csproj b/src/Cake.Frosting/Cake.Frosting.csproj index f0afed3..6bc17a3 100644 --- a/src/Cake.Frosting/Cake.Frosting.csproj +++ b/src/Cake.Frosting/Cake.Frosting.csproj @@ -23,8 +23,8 @@ portable - - + + diff --git a/template/Build.csproj b/template/Build.csproj index 8b74d30..40001ea 100644 --- a/template/Build.csproj +++ b/template/Build.csproj @@ -6,7 +6,7 @@ - + \ No newline at end of file