deploy
Showing
1 changed file
with
3 additions
and
15 deletions
| 1 | <?php | 1 | <?php |
| 2 | // Set Variables Working | 2 | // Set Variables Working |
| 3 | $LOCAL_ROOT = "/var/www/html/"; | ||
| 4 | $LOCAL_REPO_NAME = "banners-with-skip"; | ||
| 5 | $LOCAL_REPO = "{$LOCAL_ROOT}/{$LOCAL_REPO_NAME}"; | ||
| 6 | $REMOTE_REPO = "git@git.gotenzing.com:jeffmbalicki/banners-with-skip.git"; | ||
| 7 | $BRANCH = "deploy"; | ||
| 8 | 3 | ||
| 9 | if ( $_POST['payload'] ) { | ||
| 10 | // Only respond to POST requests from Github | ||
| 11 | 4 | ||
| 12 | if( file_exists($LOCAL_REPO) ) { | 5 | if ($_POST['payload'] ) { |
| 6 | // Only respond to POST requests from Github | ||
| 13 | 7 | ||
| 14 | // If there is already a repo, just run a git pull to grab the latest changes | 8 | // If there is already a repo, just run a git pull to grab the latest changes |
| 15 | shell_exec("cd {$LOCAL_REPO} && git pull"); | 9 | shell_exec("git pull"); |
| 16 | 10 | ||
| 17 | die("done " . mktime()); | 11 | die("done " . mktime()); |
| 18 | } else { | ||
| 19 | 12 | ||
| 20 | // If the repo does not exist, then clone it into the parent directory | ||
| 21 | shell_exec("cd {$LOCAL_ROOT} && git clone {$REMOTE_REPO}"); | ||
| 22 | |||
| 23 | die("done " . mktime()); | ||
| 24 | } | ||
| 25 | } | 13 | } |
| 26 | 14 | ||
| 27 | ?> | 15 | ?> | ... | ... |
-
Please register or sign in to post a comment