Webhook
A service that will listen to incoming request and do a CD job based on the incoming request payload that sent by
this GitHub Actions in the url /github/webhook.
How to Use
- Download the binary from GitHub Releases
- Create new config file with a filename
app.yml. The file name app.yml is mandatory otherwise
Viper will not find it
- Extract then run to check if there is any error in config file
tar -xzf webhook....tar.gz
./webhook
Example
Create config file with the filename app.yml
env: prod # default is dev when not set. prod will write all logs to the files in the designated folder in log keyword below.
host: 127.0.0.1 # default is 127.0.0.1
port: 7575 # default is 7575
secret: secret # this secret must be the same as in the GitHub Actions workflow
log: /path/to/where/log/file/is/stored # default is /tmp
max_worker: 1 # default is 1. this is worker count that will run the 'commands'. 1 is already good enough.
github:
- name: # required
user: # required
branch: # required
tags: # optional, default is false. this will listen only to tags ref heads.
event: # optional, default is push. this will listen only to push event.
path: # required. this the path where the 'commands' will be executed.
commands: | # optional. this is the commands that will be executed whenever the event is triggered.
echo hello
echo world
Optional (Integrate with systemd)
[Unit]
Description=instance to serve webhook service
After=network.target
[Service]
User=root
Group=your-username
ExecStart=/bin/sh -c "cd /path/to/binary/file && ./webhook"
[Install]
WantedBy=multi-user.target
- Save above systemd script in
/etc/systemd/system/ with a filename maybe something like webhook.service.
- Run and enable systemd, so it will run even after reboot.
sudo systemctl enable webhook.service --now
License
This project is licensed under the MIT License - see the LICENSE file for details.