Skip to content

Commit

Permalink
Add trigger script for github
Browse files Browse the repository at this point in the history
  • Loading branch information
pjz committed Apr 24, 2014
1 parent 34a98ba commit 43fb3b0
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions deploy_html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mv html html.prev

# move the new site to the production location
mv website-master/html html
mv website-master/deploy_html deploy_html

# clean up leftovers
rm -rf website-master $ZIPFILE
Expand Down
16 changes: 16 additions & 0 deletions html/api/github_trigger.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

require_once '/var/www/github_trigger_config.php';

if (!isset($_GET['token']) || $_GET['token'] !== SECRET_ACCESS_TOKEN ) {
header('HTTP/1.0 403 Forbidden');
echo '403 Forbidden.';
} else {
echo 'Accessed.';

if ( $_POST['payload'] ) {
echo 'Redeployed.';
shell_exec( '/var/www/deploy_html' );
}
}
?>

0 comments on commit 43fb3b0

Please sign in to comment.