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