2022-06-02 11:38:11 +08:00
2022-06-01 17:42:46 +08:00
2022-06-02 11:38:11 +08:00
2022-06-01 16:34:03 +08:00
2022-06-01 16:34:03 +08:00
2022-06-01 16:34:03 +08:00
2022-06-02 11:38:11 +08:00
2022-06-02 11:38:11 +08:00
2022-06-02 11:38:11 +08:00

Gogs Webhook Deploy

通过Gogs内置的Webhook实现自动部署项目。

要求

  • 在仓库的webhook页面正确配置
  • 部署机器上项目文件夹名与Git项目名一致
  • 部署过程需要有相应权限不可sudo
  • 部署时需要在commit message中包含[DEPLOY]字符标记(标记可以通过-s参数自定义)
  • 可能需要手动切换到对应的git分支

配置

config.json

[
      {
            "repo": "lollipopkit/example",
            "path": "/home/lolli/pro",
            "script": "deploy.py",
            "signal": "[DEPLOY]"
      }
]

运行

Usage of gogs-webhook:
  -a string
        Address to listen on (default ":3001")
  -d string
        Name of deploy script (default "deploy.py")
  -i string
        Interpreter to use for deploy script (default "python3")
  -p string
        Path to projects (default "~/pro/")
  -s string
        Signal for deploy (default "[DEPLOY]")
Description
No description provided
Readme 3.8 MiB
Languages
Go 81.5%
Python 10.5%
Dockerfile 7%
Shell 1%