Skip to content

Instantly share code, notes, and snippets.

@gep13
Created May 4, 2016 06:54
Show Gist options
  • Save gep13/cdf50d42aa7d4500bd43555013c72087 to your computer and use it in GitHub Desktop.
Save gep13/cdf50d42aa7d4500bd43555013c72087 to your computer and use it in GitHub Desktop.
Another attempt at attempting all publishing tasks....
//////////////////////////////////////////////////////////////////////
// PARAMETERS
//////////////////////////////////////////////////////////////////////
bool publishingError = false;
///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
///////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
// TASKS
//////////////////////////////////////////////////////////////////////
Task("Upload-AppVeyor-Artifacts")
.Does(() =>
{
Information("Upload-AppVeyor-Artifacts");
});
Task("Publish-MyGet")
.Does(() =>
{
Information("Publish-MyGet");
})
.OnError(exception =>
{
Information("Failed Publish-MyGet");
publishingError = true;
});
Task("Publish-NuGet")
.Does(() =>
{
Information("Publish-NuGet");
})
.OnError(exception =>
{
Information("Failed Publish-NuGet");
publishingError = true;
});
Task("Publish-Chocolatey")
.Does(() =>
{
Information("Publish-Chocolatey");
throw new Exception("Deliberately failing choco task...");
})
.OnError(exception =>
{
Information("Failed Publish-Chocolatey");
publishingError = true;
});
Task("Publish-HomeBrew")
.Does(() =>
{
Information("Publish-Homebrew");
})
.OnError(exception =>
{
Information("Failed Publish-HomeBrew");
publishingError = true;
});
Task("Publish-GitHub-Release")
.Does(() =>
{
Information("Publish-GitHub-Release");
})
.OnError(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");
========================================
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