Last active
December 14, 2016 14:40
-
-
Save superKalo/4b34cae01cb6cf3e01eb7e4e8a4fe4b5 to your computer and use it in GitHub Desktop.
Git Deployment Script. Attention, that's not really a best practice :)
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 | |
/** | |
* GIT DEPLOYMENT SCRIPT | |
* | |
* Used for automatically deploying websites via github or bitbucket, more deets here: | |
* | |
* https://gist.github.com/1809044 | |
*/ | |
// The commands | |
$commands = array( | |
'GIT_SSL_NO_VERIFY=true git pull', | |
'GIT_SSL_NO_VERIFY=true git status', | |
'GIT_SSL_NO_VERIFY=true git log --pretty=format:"%h - %an, %ar : %s" --since=3.days' | |
); | |
// Run the commands for output | |
$output = ''; | |
foreach($commands AS $command){ | |
// Run it | |
$tmp = shell_exec($command); | |
// Output | |
$output .= "<span style=\"color: #6BE234;\">\$</span> <span style=\"color: #729FCF;\">{$command}\n</span>"; | |
$output .= htmlentities(trim($tmp)) . "\n"; | |
} | |
// Make it pretty for manual user access (and why not?) | |
?> | |
<!DOCTYPE HTML> | |
<html lang="en-US"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>GIT DEPLOYMENT SCRIPT</title> | |
</head> | |
<body style="background-color: #000000; color: #FFFFFF; font-weight: bold; padding: 0 10px;"> | |
<pre> | |
. ____ . ____________________________ | |
|/ \| | | | |
[| <span style="color: #FF0000;">♥ ♥</span> |] | Git Deployment Script v0.1 | | |
|___==___| / © oodavid 2012 | | |
|____________________________| | |
<?php echo $output; ?> | |
</pre> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment