Created
April 25, 2015 13:12
-
-
Save GiovanniK/22d8ab1ed9137d9bfb12 to your computer and use it in GitHub Desktop.
Git webhook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$dir = __DIR__ . '/..'; | |
$keys = [ | |
'mijnkey' | |
]; | |
$lock = $dir . '/DEPLOY.LOCK'; | |
if (!file_exists($lock)) { | |
if (isset($_GET['key']) && in_array($_GET['key'], $keys)) { | |
file_put_contents($lock, time()); | |
shell_exec("cd $dir && php artisan down"); | |
shell_exec("cd $dir && git reset --hard origin/master"); | |
shell_exec("cd $dir && git pull 2>&1"); | |
shell_exec("cd $dir && composer install"); | |
shell_exec("cd $dir && cd ../ && cp .env manager"); | |
shell_exec("cd $dir && php artisan up"); | |
unlink($lock); | |
} | |
} | |
echo 'Ok!'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment