ba6838d5 by Jeff Balicki

deploy

1 parent 05ca0145
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 ?>