I am building an ASP.NET Core 1.1 with .csproj file using Cake. I need to push the source to Github and publish the package to MyGet. At the moment I have the script:
String target = Argument<String>("target", "Default");
Task("Clean").Does(() => {
if (DirectoryExists("./build"))
DeleteDirectory("./build", true);
CreateDirectory("./build");
});
Task("Restore").Does(() => {
FilePathCollection projects = GetFiles("./**/*.csproj");
foreach(FilePath project in projects)
DotNetCoreRestore(project.FullPath);
});
Task("Build").IsDependentOn("Clean").IsDependentOn("Restore").Does(() => {
FilePathCollection projects = GetFiles("./**/*.csproj");
foreach(FilePath project in projects)
DotNetCoreBuild(project.FullPath);
});
Task("Test").IsDependentOn("Build").Does(() => {
FilePathCollection projects = GetFiles("./test/**/*.csproj");
foreach(FilePath project in projects)
DotNetCoreTest(project.FullPath);
});
Task("Pack").IsDependentOn("Test").Does(() => {
DotNetCorePack("./src/MyProject.csproj", new DotNetCorePackSettings { OutputDirectory = "./build/MyProject/" });
});
Task("Default").IsDependentOn("Pack");
RunTarget(target);
How can I do the following:
1. Increment the revision number based on the version of the csproj file;
2. Push the project to Github;
3. Push the package to MyGet.