Publish With Github
24 Nov 2013If everything works as intended you can send push requests to our github repo and it'll get automagic deployed if we merge it.
Publishing from github is easy. You just need to set a small php page up which invokes a script to update the git repo and add the url of your php script in "web hooks" at github.
The php file:
$ cat update.php
<?php
shell_exec('./update.sh');
?>
and the update script:
$ cat update.sh
#!/bin/sh
#the logfile
datestr=$(date +%Y%m%d_%H%M%S)
LOGFILE=/your/path/log_$datestr
#cd to your git repo
cd /home/username/blog/
#update ALL TEH SOURCE
echo git >> $LOGFILE
git pull >> $LOGFILE
#Load bash_profile for jekyll
. /home/username/.bash_profile
#build page
echo jekyll >> $LOGFILE
jekyll build -d /var/www/virtual/username/html >> $LOGFILE
This replace the post-receive git hook. And will do the same work.