Skip to content

Instantly share code, notes, and snippets.

@ticky
Created March 15, 2017 01:38
Show Gist options
  • Save ticky/e8c072819bad8d2c8b5b464910412e2e to your computer and use it in GitHub Desktop.
Save ticky/e8c072819bad8d2c8b5b464910412e2e to your computer and use it in GitHub Desktop.
quick ’n dirty post-receive Jekyll builder. _scripts/build is at: https://github.com/ticky/jessicastokes.net/blob/public/_scripts/build
#!/bin/sh
set -e
GIT_REPO=$HOME/Repositories/net.jessicastokes
TMP_GIT_CLONE=$HOME/tmp/net.jessicastokes-checkout
SITE_BUILD=$HOME/tmp/net.jessicastokes-build
SITE_PROD=/usr/local/www/net.jessicastokes
if [ -d "$TMP_GIT_CLONE" ]; then
rm -rf "$TMP_GIT_CLONE"
fi
echo
echo "Deploying Website..."
echo "Cloning Repository..."
git clone --verbose "$GIT_REPO" "$TMP_GIT_CLONE"
echo
cd "$TMP_GIT_CLONE"
"$TMP_GIT_CLONE/_scripts/build" "$SITE_BUILD"
echo
echo "Copying to nginx directory..."
echo
rsync --human-readable --recursive --delete --verbose $SITE_BUILD/* "$SITE_PROD"
echo
echo "Removing temporary directories..."
echo
cd -
rm -Rf "$TMP_GIT_CLONE" "$SITE_BUILD"
echo "Done."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment