{"id":15375308,"url":"https://github.com/sy-records/git-deploy","last_synced_at":"2025-04-15T15:13:24.058Z","repository":{"id":57063379,"uuid":"272357293","full_name":"sy-records/git-deploy","owner":"sy-records","description":"🍭 Using WebHooks to automatically pull code.","archived":false,"fork":false,"pushed_at":"2023-09-25T07:31:18.000Z","size":37,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T15:13:18.518Z","etag":null,"topics":["gitee","github","swoole","webhook"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sy-records.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://donate.qq52o.me","github":"sy-records"}},"created_at":"2020-06-15T06:16:10.000Z","updated_at":"2023-12-13T09:58:59.000Z","dependencies_parsed_at":"2022-08-24T14:01:17.923Z","dependency_job_id":"d65035b0-caf8-44bb-a909-375c5322178e","html_url":"https://github.com/sy-records/git-deploy","commit_stats":{"total_commits":17,"total_committers":2,"mean_commits":8.5,"dds":"0.11764705882352944","last_synced_commit":"6ad9dbf1ed9a086f1b4b1b63efe64d3721ac93d3"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sy-records%2Fgit-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sy-records%2Fgit-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sy-records%2Fgit-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sy-records%2Fgit-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sy-records","download_url":"https://codeload.github.com/sy-records/git-deploy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249094933,"owners_count":21211837,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gitee","github","swoole","webhook"],"created_at":"2024-10-01T14:02:36.836Z","updated_at":"2025-04-15T15:13:24.038Z","avatar_url":"https://github.com/sy-records.png","language":"PHP","readme":"# Git Deploy\n\n[![Latest Stable Version](https://poser.pugx.org/sy-records/git-deploy/v)](//packagist.org/packages/sy-records/git-deploy) [![Total Downloads](https://poser.pugx.org/sy-records/git-deploy/downloads)](//packagist.org/packages/sy-records/git-deploy) [![Latest Unstable Version](https://poser.pugx.org/sy-records/git-deploy/v/unstable)](//github.com/sy-records/git-deploy) \n[![License](https://poser.pugx.org/sy-records/git-deploy/license)](LICENSE)\n\n🍭 Using WebHooks to automatically pull code.\n\n## Support\n\n* [x] GitHub\n* [x] Gitee\n* [x] Gitea\n* [x] GitLab\n\n## 依赖\n\n* php \u003e= 7.1\n* ext-swoole （可以直接使用 [swoole-cli](https://github.com/swoole/swoole-src/releases/latest)）\n\n## 安装\n\n```shell\ncomposer create-project sy-records/git-deploy\n```\n\n## 配置\n\n1. 修改配置文件`config.json`\n\n`server`对应的是`Swoole\\Http\\Server`的相关配置\n\n* `ip`：IP地址  \n* `port`：端口  \n* `mode`：启动模式 `SWOOLE_BASE/SWOOLE_PROCESS`  \n* `settings`：Server的配置  \n\n\u003e 正式运行时需要启动守护进程，将`daemonize`修改为`1`\n\n```json\n\"server\": {\n  \"ip\": \"0.0.0.0\",\n  \"port\": 9666,\n  \"mode\": 1,\n  \"settings\": {\n    \"worker_num\": 1,\n    \"daemonize\": 0\n  }\n},\n```\n\n`sites`对应的是项目的仓库等信息\n\n分为`github`和`gitee`，`key`是仓库名称，支持多个仓库。\n\n* `secret`/`password`：密钥/密码；`github`使用`secret`，`gitee`的 WebHook 密码使用`password`，签名密钥使用`secret`\n* `ref`：分支  \n* `event_name`：事件名称；`github`为`push`，`gitee`为`push_hooks`\n* `shells`：需要执行的脚本\n\n```json\n\"sites\": {\n  \"github\": {\n      \"sy-records/git-deploy\": {\n        \"secret\": \"password\",\n        \"ref\": \"refs/heads/master\",\n        \"event_name\": \"push\",\n        \"shells\": [\n          \"git -C /yourpath/git-deploy pull\"\n        ]\n      }\n  },\n  \"gitee\": {\n      \"sy-records/git-deploy\": {\n        \"password\": \"password\",\n        \"ref\": \"refs/heads/master\",\n        \"event_name\": \"push_hooks\",\n        \"shells\": [\n          \"git -C /yourpath/git-deploy pull\"\n        ]\n    }\n  },\n  \"gitea\": {\n    \"sy-records/git-deploy\": {\n      \"secret\": \"password\",\n      \"ref\": \"refs/heads/master\",\n      \"event_name\": \"push\",\n      \"shells\": [\n        \"git -C /yourpath/git-deploy pull\"\n      ]\n    }\n  },\n  \"gitlab\": {\n    \"sy-records/git-deploy\": {\n      \"secret\": \"password\",\n      \"ref\": \"refs/heads/master\",\n      \"event_name\": \"push\",\n      \"shells\": [\n        \"git -C /yourpath/git-deploy pull\"\n      ]\n    }\n  }\n}\n```\n\n2. 填写WebHook\n\nURL：`http://ip:port/github` or `http://ip:port/gitee`  \n\nSecret/PassWord：对应`config.json`中的`secret/password`\n\n## 启动\n\n```shell\nphp start.php\n```\n\n### systemd\n\n```conf\n[Unit]\nDescription=Git Depoly Service\nAfter=network.target\n\n[Service]\nExecStart=/usr/bin/php /workspace/git-deploy/start.php\nRestart=always\nRestartSec=3\n\n[Install]\nWantedBy=multi-user.target\n```\n","funding_links":["https://donate.qq52o.me","https://github.com/sponsors/sy-records"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsy-records%2Fgit-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsy-records%2Fgit-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsy-records%2Fgit-deploy/lists"}