使用 PHP 和 GitHub Webhooks 实现自动部署
https://github.com/mdluo/github-webhook-handler-php
-
Add a weebhook in the Settings/Webhooks page of your respostory.
-
Update the
$secretand$pathin thegithub-webhook-handler.php. -
Upload
github-webhook-handler.phpto your server and copy the URL to it. -
Fill in the webhooks page.
-
ssh to your server.
1
2
3
4
5
#if you are using Apache as web server, change `www-data` to `www`
chown -R www-data /path/to/the/repository/
chmod -R g+s /path/to/the/repository/
cd /path/to/the/repository/
sudo -u www-data git pull
-
Save your webhook.
- Reference:
- http://www.lovelucy.info/auto-deploy-website-by-webhooks-of-github-and-gitlab.html
- http://www.v2ex.com/t/224238#2