From 55cfad42db46c852178ae7fd6b542de3efc2f4a1 Mon Sep 17 00:00:00 2001 From: Alex Cabal Date: Wed, 13 Mar 2019 18:01:23 -0500 Subject: [PATCH] Set GitHub hook to deploy to web on update --- www/webhooks/github.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/www/webhooks/github.php b/www/webhooks/github.php index c7dcec89..c7c0bedf 100644 --- a/www/webhooks/github.php +++ b/www/webhooks/github.php @@ -91,6 +91,17 @@ try{ else{ Logger::WriteGithubWebhookLogEntry($requestId, 'git pull from GitHub complete.'); } + + // Our local repo is now updated. Build the ebook! + exec('/standardebooks.org/scripts/deploy-ebook-to-www ' . escapeshellarg($dir), $output, $returnCode); + if($returnCode != 0){ + Logger::WriteGithubWebhookLogEntry($requestId, 'Error deploying ebook to web. Output: ' . implode("\n", $output)); + throw new WebhookException('Couldn\'t process ebook.', $post); + } + else{ + Logger::WriteGithubWebhookLogEntry($requestId, 'Deploy to web complete.'); + } + break; default: throw new WebhookException('Unrecognized GitHub webhook event.', $post);