Created
February 4, 2012 18:06
-
-
Save fideloper/1739249 to your computer and use it in GitHub Desktop.
Beanstalk Post deploy hooks
This file contains 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
<?php | |
$deploy_json = @file_get_contents('php://input'); | |
if (!empty($deploy_json)) | |
{ | |
$deploy_data = json_decode($deploy_json); | |
//Log output to file (overwrites on each deploy). Make sure file is 0777 | |
file_put_contents('results.txt', print_r($deploy_data, true)); | |
/* Optional - Do some actions based on deploy comments | |
if (empty($deploy_data->comment) || strcasecmp(substr($deploy_data->comment, 0, 10), 'LIVEUPDATE') != 0) | |
{ | |
// unless the comments start with LIVEUPDATE | |
// then show the "down for maintenance" page | |
//$this->go_maintenance(); | |
} | |
*/ | |
} | |
/* | |
Output: | |
stdClass Object | |
( | |
[server] => Dev Server | |
[environment] => Test Deploy | |
[repository_url] => git@someaccount.beanstalkapp.com:/test.git | |
[author_name] => Chris Fidao | |
[source] => beanstalkapp | |
[author] => fideloper | |
[repository] => test | |
[deployed_at] => 2012/02/04 17:47:02 +0000 | |
[revision] => aac271d124eb12e59aeabe20e5ec4eeaa0a7688b | |
[author_email] => chris@email.com | |
[comment] => New readme file | |
) | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment