diff --git a/publish.sh b/publish.sh index f9076aa7..b989deb5 100755 --- a/publish.sh +++ b/publish.sh @@ -5,29 +5,26 @@ set -e SITE_ENV="prod" REPO=`git config remote.origin.url` SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:} -SHA=`git rev-parse --verify HEAD` -SOURCE_BRANCH="source" -TARGET_BRANCH="master" -BUILD_DIR=".build" # Prepare the build directory. -git clone $REPO $BUILD_DIR -pushd $BUILD_DIR -git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH +git clone $REPO _deploy +pushd _deploy +git checkout master || git checkout --orphan master popd rm -rf ${BUILD_DIR}/**/* || exit 0 # Re-generate the site. npm run prod -vendor/bin/sculpin generate --no-interaction --clean --env=${SITE_ENV} -touch output_${SITE_ENV}/.nojekyll +vendor/bin/sculpin generate --no-interaction --clean --env=prod +touch output_prod/.nojekyll # Add, commit and push the changes. -mv output_${SITE_ENV}/* $BUILD_DIR -pushd $BUILD_DIR +mv output_prod/* _deploy +pushd _deploy +echo "!/assets/css/ +!/assets/images/ +!/assets/js/" > .gitignore git add --all -f . -git commit -m "Re-generate site: $SHA" +git commit -m "Re-generate site: `git rev-parse --verify HEAD`" git push $SSH_REPO $TARGET_BRANCH popd - -rm -rf $BUILD_DIR