Auto deploy with GitHub webhook
- Run
make build
from directory for configurationrepository + branch
- Send build status to specific chat in telegram
/ping
- response with status OK/hook/github
- webhook for GitHub Webhooks- response with status Accepted if deploy has been started
- response with status NonAcceptable if deploy impossible to start (invalid payload, not push event and another)
- For deploy will be created only one job, other deploy jobs will be canceled
- If push event accepted but repository or branch not configured - job will be skipped
Go
v1.21+make
in system
- Clone this repository
git clone https://github.com/toppi-me/deployer.git
- Create .env file
cp .env.example .env
- Create config file
cp .config.json.example .config.json
- Setup
.env
andconfig.json
files with your data - Run
go mod download
andgo build .
- Run
chmod +x deployer
nano
orvim
/etc/systemd/system/deployer.service
Example of deployer.service
file
[Unit]
Description=Deployer
After=network.target
[Service]
User=root
Group=root
WorkingDirectory=/root/toppi-me/deployer
ExecStart=/root/toppi-me/deployer/deployer
Restart=always
[Install]
WantedBy=multi-user.target
- Need to change
User
,Group
and path to binaryExecStart
- Start service
sudo systemctl start deployer.service
Any contributions are welcome, also if there are problems in the process, then create an issue