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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
| var target = Argument("target", "pack"); #addin nuget:?package=Cake.Git
Task("ensureRepos") .Does(()=> { Information("Downloading source codes..."); EnsureDirectoryExists("git-repos"); var username = "gituser"; var password = "gitpassword";
if(!DirectoryExists("git-repos/admin")) { CreateDirectory("git-repos/admin"); Information("Clone admin..."); GitClone("http://git.domain.com/xxx/admin.git", "git-repos/admin", username, password); } else { GitPull("git-repos/admin","cake-ci","email",username,password,"origin"); }
if(!DirectoryExists("git-repos/api")) { CreateDirectory("git-repos/api"); GitClone("http://git.domain.com/xxx/api.git", "git-repos/api", username, password); Information("Clone api..."); } else { GitPull("git-repos/api","cake-ci","email",username,password,"origin"); }
if(!DirectoryExists("git-repos/watch")) { CreateDirectory("git-repos/watch"); GitClone("http://git.domain.com/xxx/watch.git", "git-repos/watch", username, password); Information("Clone watch..."); } else { GitPull("git-repos/watch","cake-ci","email",username,password,"origin"); } });
Task("clean") .Does(()=> { if(DirectoryExists("release")) { CleanDirectories("release"); } });
Task("publish-api") .Does(()=> { EnsureDirectoryExists("release"); var settingsApi = new DotNetCorePublishSettings { Framework = "netcoreapp2.0", Configuration = "Release", OutputDirectory = "./release/api" }; DotNetCorePublish("./git-repos/api/Namespace.Api",settingsApi); });
Task("publish-admin") .Does(()=> { EnsureDirectoryExists("release"); var settings = new DotNetCorePublishSettings { Framework = "netcoreapp2.0", Configuration = "Release", OutputDirectory = "./release/admin" }; DotNetCorePublish("./git-repos/admin/backend/Namespace.Admin",settings); });
Task("publish-watch") .Does(()=> { EnsureDirectoryExists("release");
var solutions = GetFiles("./git-repos/watch/*.sln"); foreach(var solution in solutions) { Information("Restoring {0}", solution); NuGetRestore(solution); }
MSBuild("./git-repos/watch/Namespace.WatchClient", new MSBuildSettings { Verbosity = Verbosity.Minimal, ToolVersion = MSBuildToolVersion.VS2017, Configuration = "Release", ArgumentCustomization = args=>args.Append("/p:PreBuildEvent= /p:PostBuildEvent="), PlatformTarget = PlatformTarget.MSIL }); CopyDirectory("./git-repos/watch/CameraSDK", "./git-repos/watch/Namespace.WatchClient/bin/Release/CameraSDK"); CopyDirectory("./git-repos/watch/Namespace.WatchClient/bin/Release", "./release/client"); });
Task("publish") .IsDependentOn("publish-api") .IsDependentOn("publish-admin") .IsDependentOn("publish-watch") .Does(()=> { CopyDirectory("./replace/admin", "./release/admin"); CopyDirectory("./replace/api", "./release/api"); CopyDirectory("./replace/client", "./release/client"); });
Task("pack") .IsDependentOn("ensureRepos") .IsDependentOn("clean") .IsDependentOn("publish") .Does(() => {
});
RunTarget(target);
|