cexll / swoole-webhook
Using WebHooks to automatically pull code
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 1
Forks: 0
Open Issues: 0
Type:project
pkg:composer/cexll/swoole-webhook
Requires
- php: >=7.2
- ext-json: *
- swoole/ide-helper: @dev
README
Using WebHooks to automatically pull code
Support
- GitHub
- Gitee
Require
- php >= 7.2
- ext-swoole >= 4.5
Install
composer create-project cexll/swoole-webhook
Configure
- vim
config.json
"server": { "ip": "0.0.0.0", "port": 9501, "mode": 1, // SWOOLE_BASE=1, SWOOLE_PROCESS=2 "setting": { "worker_num": 1, "task_worker_num": 1, "task_enable_coroutine": true, "daemonize": true // 后台运行 } }
server对应的是Swoole\Http\Server的相关配置
ip:IP地址port:端口mode:启动模式SWOOLE_BASE/SWOOLE_PROCESSsettings:Server的配置
设置 daemonize => true 时,程序将转入后台作为守护进程运行。长时间运行的服务器端程序必须启用此项。 如果不启用守护进程,当 ssh 终端退出后,程序将被终止运行。
sites对应的是项目的仓库等信息
分为github和gitee,name是仓库名称,支持多个仓库。
secret/password:密钥/密码;github使用secret,gitee的 WebHook 密码使用password,签名密钥使用secretref:分支hook_name:事件名称;github为push,gitee为push_hookscmds:需要执行的脚本/命令
"sites": { "github": [{ "name": "cexll/swoole-webhook", "secret": "password", "ref": "refs/heads/master", "hook_name": "push", "cmds": [ "git -C /yourpath/project pull" ] }], "gitee": [{ "name": "cexll/swoole-webhook", "password": "password", "ref": "refs/heads/master", "hook_name": "push_hooks", "cmds": [ "git -C /yourpath/project pull" ] }] }
- 填写WebHook
URL:http://ip:port/github or http://ip:port/gitee
Secret/PassWord:对应config.json中的secret/password
Start
php run.php
License
Apache License Version 2.0, http://www.apache.org/licenses/