Skip to content

Instantly share code, notes, and snippets.

@fl3a
Last active March 30, 2019 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fl3a/032fadb155a75adac03c85cf204051f6 to your computer and use it in GitHub Desktop.
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
#!/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