Created
April 21, 2018 23:27
-
-
Save dennisotugo/dd60dfd0ee56161217fa3d5477fe87b5 to your computer and use it in GitHub Desktop.
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 | |
/** | |
* GIT DEPLOYMENT SCRIPT | |
* | |
* Used for automatically deploying websites via GitHub | |
* | |
*/ | |
// array of commands | |
$commands = array( | |
'echo $PWD', | |
'whoami', | |
'git pull', | |
'git status', | |
'git submodule sync', | |
'git submodule update', | |
'git submodule status', | |
); | |
// exec commands | |
$output = ''; | |
foreach($commands AS $command){ | |
$tmp = shell_exec($command); | |
$output .= "<span style=\"color: #6BE234;\">\$</span><span style=\"color: #729FCF;\">{$command}\n</span><br />"; | |
$output .= htmlentities(trim($tmp)) . "\n<br /><br />"; | |
} | |
?> | |
<!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;"> | |
<div style="width:700px"> | |
<div style="float:left;width:350px;"> | |
<p style="color:white;">Git Deployment Script</p> | |
<?php echo $output; ?> | |
</div> | |
</div> | |
</body> | |
</html> | |
$git add deploy.php | |
$git commit -m 'Adding the git deployment script' | |
$git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment