GitHub Post-Hook server with project deployment
$ git clone https://github.com/MustHash/shepherd.git
$ cd shepherd
$ npm install
Edit the config.json
file to match your preferences.
$ npm start
{
"log": "../logs/shepherd.log",
"repository": "MustHash/fuckyourcode.com",
"branch": "master",
"repository-folder": "../public",
"port": 3001,
"post-script": ""
}
- log : where the log file will be written
- repository : which repository should the server pay attention
- branch : which branch should the server pay attention
- repository-folder : where should shepherd issue the git pull command
- port : which port should the server listen to
- post-script : a given script that will be required when the pull is successful
The directories chosen are mainly examples, adapt to your needs.
cd /var/www/fuckyourcode.com
git clone https://github.com/MustHash/fuckyourcode.com.git .
git checkout deploy-branch
cd /var/www/private/shepherd
npm start
Notice that in the config.json
file the repository folder should match the /var/www/fuckyourcode.com
If the git pull
command keeps asking you for a password, create a ssh keys-pair without passphrase
and add the key to the Deploy key
in the repository settings (https://github.com/{Username}/{repository}/settings/keys).