Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////////////////////////////////////
- // ARGUMENTS
- //////////////////////////////////////////////////////////////////////
- var target = Argument("target", "Default");
- var configuration = Argument("configuration", "Release");
- var version = Argument<string>("buildVersion", "0.0.1");
- //////////////////////////////////////////////////////////////////////
- // GLOBAL VARIABLES
- //////////////////////////////////////////////////////////////////////
- var artifacts = "./artifacts/";
- var packages = string.Concat(artifacts, "packages/");
- var solution = GetFiles("./**/*.sln").First().FullPath;
- ///////////////////////////////////////////////////////////////////////////////
- // Clean Environment
- ///////////////////////////////////////////////////////////////////////////////
- Task("Setup").Does(()=> {
- var nugetSourceSettings = new NuGetSourcesSettings
- {
- UserName = EnvironmentVariable("PRIVATE_FEED_USERNAME"),
- Password = EnvironmentVariable("PRIVATE_FEED_PASSWORD"),
- IsSensitiveSource = true,
- Verbosity = NuGetVerbosity.Detailed
- };
- var feed = new
- {
- Name = "Magnoxium",
- Source = EnvironmentVariable("PRIVATE_FEED_SOURCE")
- };
- NuGetAddSource(
- name:feed.Name,
- source:feed.Source,
- settings:nugetSourceSettings
- );
- });
- Task("Clean")
- .IsDependentOn("Setup")
- .Does(() => {
- CleanDirectories("./**/bin");
- CleanDirectories("./**/obj");
- CleanDirectories("./**/artifacts");
- });
- Task("Restore")
- .IsDependentOn("Clean")
- .Does(() =>
- {
- NuGetRestore(solution);
- });
- ///////////////////////////////////////////////////////////////////////////////
- // Build Projects
- ///////////////////////////////////////////////////////////////////////////////
- Task("Build")
- .IsDependentOn("Restore")
- .Does(() =>
- {
- var buildSettings = new DotNetCoreBuildSettings
- {
- Configuration = configuration,
- ArgumentCustomization = args => args.Append("/p:SemVer=" + version)
- };
- DotNetCoreBuild(solution, buildSettings);
- });
- ///////////////////////////////////////////////////////////////////////////////
- // Create Nuget Packages
- ///////////////////////////////////////////////////////////////////////////////
- Task("Pack")
- .IsDependentOn("Build")
- .Does(() =>
- {
- DotNetCoreMSBuildSettings buildSettings = new DotNetCoreMSBuildSettings();
- buildSettings.SetVersionPrefix(version);
- var settings = new DotNetCorePackSettings
- {
- NoBuild = true,
- MSBuildSettings = buildSettings,
- Configuration = configuration,
- OutputDirectory = packages
- };
- var projects = GetFiles("./src/**/*.csproj");
- foreach(var project in projects)
- {
- DotNetCorePack(project.FullPath, settings);
- }
- });
- //////////////////////////////////////////////////////////////////////
- // TASK TARGETS
- //////////////////////////////////////////////////////////////////////
- Task("Default")
- .IsDependentOn("Pack");
- //////////////////////////////////////////////////////////////////////
- // EXECUTION
- //////////////////////////////////////////////////////////////////////
- RunTarget(target);
Add Comment
Please, Sign In to add comment