Created
November 28, 2014 10:19
-
-
Save opdavies/f2410e33c36dc75b4e97 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/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