Last active
March 30, 2019 16:42
-
-
Save fl3a/032fadb155a75adac03c85cf204051f6 to your computer and use it in GitHub Desktop.
Deployment of Jekyll-Sites on Uberspace via Git Bare Repository and post-receive Hook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Deployment of Jekyll-Sites on Uberspace | |
# via Git Bare Repository and post-receive Hook. | |
# | |
# See https://netzaffe.de/jekyll-deployment-auf-uberspace-via-bare-repo-und-post-receive-hook/ | |
# for requirements and more detailed description (german) | |
read oldrev newrev ref | |
pushed_branch=${ref#refs/heads/} | |
## Variables | |
build_branch='master' | |
site='example.com' | |
site_prefix='int.' | |
git_repo=${HOME}/repos/${site}.git | |
tmp=${HOME}/repos/tmp/${site} | |
www=/var/www/virtual/${USER}/${site_prefix}${site} | |
## Do the magic | |
[ $pushed_branch != $build_branch ] && exit | |
git clone ${git_repo} ${tmp} | |
cd ${tmp} | |
bundle install --path=~/.gem | |
JEKYLL_ENV=production jekyll build --source ${tmp} --destination ${www} | |
rm -rf ${tmp} | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment