把github代码自动部署到服务器

时间:2022-07-22 14:51:56

一、参考文献

https://developer.github.com/webhooks/

https://docs.gitlab.com/ee/user/project/integrations/webhooks.html

https://segmentfault.com/a/1190000011561808

https://excaliburhan.com/post/add-webhooks-to-your-project.html

https://aotu.io/notes/2016/01/07/auto-deploy-website-by-webhooks-of-github/index.html

https://zhuanlan.zhihu.com/p/30644932

二、操作步骤

1、编写自动部署脚本

进入项目目录,拉取最新的代码,构建代码。

2、设置webhook

Webhooks的作用就是在特定的事件执行的时候触发自定义的动作。本质上,Github的Webhooks触发后,会给相应的URL发送POST请求,请求头中含有event等相应的信息。

把github代码自动部署到服务器