Go to file
Urko 19f17308b1 feat: test pkg watcher 2023-02-26 16:07:14 +01:00
cfg feat: add config 2023-02-26 10:59:22 +01:00
internal/watcher feat: test watcher 2023-02-26 10:58:55 +01:00
pkg/watcher feat: test pkg watcher 2023-02-26 16:07:14 +01:00
.env.example feat: add .env.example 2023-02-26 10:59:08 +01:00
.gitignore feat: update gitignore 2023-02-26 11:07:25 +01:00
Makefile feat: update makefile 2023-02-26 11:07:30 +01:00
README.md feat: update README 2023-02-26 11:07:21 +01:00
go.mod feat: main 2023-02-26 10:59:33 +01:00
go.sum feat: main 2023-02-26 10:59:33 +01:00
main.go feat: main 2023-02-26 10:59:33 +01:00

README.md

git-webhook-ci

Tool to automatize your deploy based on file write changes

Description

After some change is made in our listener file the script placed on path set on env variable called WEBHOOK_SCRIPT_PATH will be executed.

Context

As a security risk that could be allow a webhook listener on a VPS for your git repository, I've decided to create this package which is a listener to file changes on write. This will trigger a bash script which you shold place on your server to run desired tasks. In my case I've done this to run a bash deploy command like

  • git pull
  • build
  • move build to desired dir
  • restart services like nginx or whatever

Installation

Requirements

Environment Vars

As shown in .env.example you have to configure this variables in order to make your binary works right:

SCRIPT_BINARY_PATH=/bin/bash
WEBHOOK_SCRIPT_PATH=/path/to/mybashscript.sh
FILE_TO_WATCH_PATH=/path/to/myfile.txt
TEST_FILE_TO_WATCH_PATH=./test_monitor.txt

TEST_FILE_TO_WATCH_PATH is needed just to run tests

How to use

Build

To build you can only just make build command

make build