This php script builds a repository automatically after a commit is pushed to GitHub using webhooks. It should be placed in a web server, so GitHub can access it and create a POST request.
- Clone the repository to be built and change the repository directory ownership to www-data:
sudo chown -R www-data:www-data /path/to/repository
. - Copy the php script to somewhere inside your web server.
- Create a webhook on GitHub, setting the payload URL as the location used in the previous step.
- Set the
repositoryPath
andhookSecret
variables at the beginning of the code. - Change the build command according to your project. The default is simply
make
.