Last active
May 4, 2016 06:30
-
-
Save gep13/028b4d3f3a98c3cbdfb122da9a35fdf8 to your computer and use it in GitHub Desktop.
Attempt all publishing tasks, and fail build if one of them fails
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////////////////////////////////////////////////////////////////////// | |
// PARAMETERS | |
////////////////////////////////////////////////////////////////////// | |
bool publishingError = false; | |
/////////////////////////////////////////////////////////////////////////////// | |
// SETUP / TEARDOWN | |
/////////////////////////////////////////////////////////////////////////////// | |
////////////////////////////////////////////////////////////////////// | |
// TASKS | |
////////////////////////////////////////////////////////////////////// | |
Task("Upload-AppVeyor-Artifacts") | |
.Does(() => | |
{ | |
Information("Upload-AppVeyor-Artifacts"); | |
}); | |
Task("Publish-MyGet") | |
.ContinueOnError() | |
.Does(() => | |
{ | |
Information("Publish-MyGet"); | |
}) | |
.ReportError(exception => | |
{ | |
Information("Failed Publish-MyGet"); | |
publishingError = true; | |
}); | |
Task("Publish-NuGet") | |
.ContinueOnError() | |
.Does(() => | |
{ | |
Information("Publish-NuGet"); | |
}) | |
.ReportError(exception => | |
{ | |
Information("Failed Publish-NuGet"); | |
publishingError = true; | |
}); | |
Task("Publish-Chocolatey") | |
.ContinueOnError() | |
.Does(() => | |
{ | |
Information("Publish-Chocolatey"); | |
throw new Exception("Deliberately failing choco task..."); | |
}) | |
.ReportError(exception => | |
{ | |
Information("Failed Publish-Chocolatey"); | |
publishingError = true; | |
}); | |
Task("Publish-HomeBrew") | |
.ContinueOnError() | |
.Does(() => | |
{ | |
Information("Publish-Homebrew"); | |
}) | |
.ReportError(exception => | |
{ | |
Information("Failed Publish-HomeBrew"); | |
publishingError = true; | |
}); | |
Task("Publish-GitHub-Release") | |
.ContinueOnError() | |
.Does(() => | |
{ | |
Information("Publish-GitHub-Release"); | |
}) | |
.ReportError(exception => | |
{ | |
Information("Failed Publish-GitHub-Release"); | |
publishingError = true; | |
}); | |
////////////////////////////////////////////////////////////////////// | |
// TASK TARGETS | |
////////////////////////////////////////////////////////////////////// | |
Task("AppVeyor") | |
.IsDependentOn("Upload-AppVeyor-Artifacts") | |
.IsDependentOn("Publish-MyGet") | |
.IsDependentOn("Publish-NuGet") | |
.IsDependentOn("Publish-Chocolatey") | |
.IsDependentOn("Publish-HomeBrew") | |
.IsDependentOn("Publish-GitHub-Release") | |
.Finally(() => | |
{ | |
if(publishingError) | |
{ | |
throw new Exception("An error occurred during the publishing of Cake. All publishing tasks have been attempted."); | |
} | |
}); | |
////////////////////////////////////////////////////////////////////// | |
// EXECUTION | |
////////////////////////////////////////////////////////////////////// | |
RunTarget("AppVeyor"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
======================================== | |
Upload-AppVeyor-Artifacts | |
======================================== | |
Upload-AppVeyor-Artifacts | |
======================================== | |
Publish-MyGet | |
======================================== | |
Publish-MyGet | |
======================================== | |
Publish-NuGet | |
======================================== | |
Publish-NuGet | |
======================================== | |
Publish-Chocolatey | |
======================================== | |
Publish-Chocolatey | |
An error occured when executing task 'Publish-Chocolatey'. | |
Failed Publish-Chocolatey | |
======================================== | |
Publish-HomeBrew | |
======================================== | |
Publish-Homebrew | |
======================================== | |
Publish-GitHub-Release | |
======================================== | |
Publish-GitHub-Release | |
======================================== | |
AppVeyor | |
======================================== | |
Error: An error occurred during the publishing of Cake. All publishing tasks have been attempted. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment