A post-receive hook designed to take a pushed jekyll git repository and deploy it to a web directoy on the server.
Uses a releases / current symlink to point to the current site.
Deploys would go to: ssh://user@10.0.0.0/var/repo/yourdomain.com.git
A post-receive hook designed to take a pushed jekyll git repository and deploy it to a web directoy on the server.
Uses a releases / current symlink to point to the current site.
Deploys would go to: ssh://user@10.0.0.0/var/repo/yourdomain.com.git
#!/bin/sh | |
RELEASE=$(date +%s) | |
WEB_DIR=/var/www/yourdomain.com | |
REPO_DIR=/var/repo/yourdomain.com.git | |
RELEASE_DIR=$WEB_DIR/releases/$RELEASE | |
git --work-tree=$WEB_DIR/src --git-dir=$REPO_DIR checkout -f | |
cd $WEB_DIR/src | |
bundle install --quiet --path ~/vendor/bundle | |
mkdir $RELEASE_DIR | |
bundle exec jekyll build -d $RELEASE_DIR | |
rm $WEB_DIR/current && ln -s $RELEASE_DIR $WEB_DIR/current |