Commit 023191fb authored by Peter Göbel's avatar Peter Göbel

initial commit

parent 464c1827
Deploy websites from git.debd.com (or any other git-service) directly
### How to
1. Pull git repository to root of your project
2. Copy `deploy.php` to the root of your project
3. Add a webhook to your project on git.debd.com: simply add the URL to this file, e.g. debd.com/client/foo/bar/deploy.php
4. Done! Now, the site will be deployed after each push
#### Additional information
- You can use this script for every git-service that supports webhooks (like github.com or bitbucket.com)
- Be aware that you have to add a ssh-key from your server to the git-service (git.debd.com and debd.com are connected already)
\ No newline at end of file
<?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(
'echo $PWD',
'whoami',
'git pull',
'git status'
);
// 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?)
$content = '
<!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;">o o</span> |] | Git Deployment Script v0.1 |
|___==___| / &copy; oodavid 2012 |
|____________________________|
' . $output . '
</pre>
</body>
</html>';
echo $content;
$log = 'logs/' . time() . '_deploy.html';
$handle = fopen($log, 'w') or die('Cannot open file: '.$log);
fwrite($handle, $content);
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment