CI service written in node, inspired by node-cd
git clone https://github.com/backmeupplz/ci-ninja
on the server- Add scripts with the name like
{repository-name}-{branch-name}.sh
toscripts
- Make sure the files are executable (like
sudo chmod +x {repository-name}-{branch-name}.sh
) - Add Webhook from your GitHub repository to
http://{server-ip}:61439
Aaaaand you're done.
My sample deploy script that I put on the server in scripts
folder.
#!/bin/bash
set -e
{ # try
cd /home/memcoin &&
git reset --hard &&
git pull &&
yarn &&
yarn build-ts &&
sudo systemctl restart memcoin &&
curl 'https://api.telegram.org/bot1234/sendMessage?chat_id=1234&text=✅ Memcoin deployed'
} || { # catch
curl 'https://api.telegram.org/bot1234/sendMessage?chat_id=1234&text=💥 Memcoin failed to deploy'
}
My sample systemd service for ubuntu to run ci-ninja
[Unit]
Description=Service to start ci-ninja
After=network.target
[Service]
WorkingDirectory=/home/ci-ninja
ExecStart=/usr/bin/node /home/ci-ninja/index.js
[Install]
WantedBy=multi-user.target
My sample systemd service for Telegram bots
[Unit]
Description=Service to start memcoin Telegram bot
After=mongodb.service
[Service]
WorkingDirectory=/home/memcoin
ExecStart=/usr/bin/yarn distribute
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
MIT — use for any purpose. Would be great if you could leave a note about the original developers. Thanks!