Skip to content

Instantly share code, notes, and snippets.

@opdavies
Created November 28, 2014 10:19
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 opdavies/f2410e33c36dc75b4e97 to your computer and use it in GitHub Desktop.
Save opdavies/f2410e33c36dc75b4e97 to your computer and use it in GitHub Desktop.
#!/bin/sh
SOURCE=~/path/to/source
TARGET=~/path/to/target
ENV=prod
REMOTE_NAME=origin
REMOTE_BRANCH=master
echo "Ensure that the target repository is up to date."
cd ${TARGET}
git pull --rebase
echo "Rebuilding the source site."
cd ${SOURCE}
LOG=$(git log --oneline -n 1)
echo ${LOG}
sculpin generate --env ${ENV}
OUTPUT_DIR=${SOURCE}/output_${ENV}
rm -rf ${SOURCE}/output_${ENV}/.git
cp -R ${TARGET}/.git ${OUTPUT_DIR}
cd ${OUTPUT_DIR}
echo ${OUTPUT_DIR}
# Add and commit the files.
git add . --all
git reset -- CNAME
git commit -m "${LOG}"
git push ${REMOTE_NAME} ${REMOTE_BRANCH}
# Ensure that we're left with a clean directory.
git reset --hard && git clean -fd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment