Created
August 27, 2018 13:08
-
-
Save rubenmromero/dee3f421fd42301d06f9b8232cd0ac77 to your computer and use it in GitHub Desktop.
PHP :: Web service to clean and deploy a repository to which it belongs on a server through a webhook
This file contains 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 | |
//Deploy the current version from master branch of the project | |
$document_root = "<repository_root_folder>"; | |
echo "Clean untracked files on server:"; | |
$output = shell_exec("git clean -d --force $document_root 2>&1"); | |
echo "<pre>$output</pre>"; | |
echo "Revert modified files (not staged) on server..."; | |
$output = shell_exec("git checkout -- $document_root 2>&1"); | |
echo "<pre>$output</pre>"; | |
echo "Pull the existent new commits from origin on server:"; | |
$output = shell_exec("git pull 2>&1"); | |
echo "<pre>$output</pre>"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment