private void TriggerAppHarborBuild(FederatedUploadCredentials credentials)
{
_writer.WriteLine("The package will be deployed to application \"{0}\".", ApplicationId);
if (string.IsNullOrEmpty(_message))
{
using (new ForegroundColor(ConsoleColor.Yellow))
{
_writer.WriteLine();
_writer.Write("Enter a deployment message: ");
}
_message = _reader.ReadLine();
}
var request = new RestRequest("applications/{slug}/buildnotifications", Method.POST)
{
RequestFormat = DataFormat.Json
}
.AddUrlSegment("slug", ApplicationId)
.AddHeader("Authorization", string.Format("BEARER {0}", _accessToken))
.AddBody(new
{
Bucket = credentials.Bucket,
ObjectKey = credentials.ObjectKey,
CommitMessage = string.IsNullOrEmpty(_message) ? "Deployed from CLI" : _message,
});
_writer.WriteLine("Notifying AppHarbor.");
var response = _restClient.Execute(request);
if (response.StatusCode == HttpStatusCode.OK)
{
using (new ForegroundColor(ConsoleColor.Green))
{
_writer.WriteLine("Deploying... Open application overview with `appharbor open`.");
}
}
}