Last active
August 29, 2015 13:57
-
-
Save namanyayg/9386508 to your computer and use it in GitHub Desktop.
Deployment POST-hook script for bitbucket to server cloning
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
<?php | |
$payload = ''; | |
if ( isset($_POST['payload']) ){ | |
$payload = json_decode($_POST['payload']); | |
} else { | |
return false; | |
} | |
$repo = $payload->repository; | |
exec('git init && git remote add origin [email protected]:' . $repo->absolute_url . '.git . && git pull origin master'); | |
file_put_contents('bitbucket-deployment.log', 'Last run on: ' . date('m/d/Y h:i:s a'), FILE_APPEND); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment