Ensure we have the latest changes
This commit is contained in:
parent
171d9b82dd
commit
23f5923e48
26
publish.sh
26
publish.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -uex
|
set -e
|
||||||
|
|
||||||
SITE_ENV="prod"
|
SITE_ENV="prod"
|
||||||
REPO=`git config remote.origin.url`
|
REPO=`git config remote.origin.url`
|
||||||
|
@ -8,19 +8,27 @@ SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
|
||||||
SHA=`git rev-parse --verify HEAD`
|
SHA=`git rev-parse --verify HEAD`
|
||||||
SOURCE_BRANCH="source"
|
SOURCE_BRANCH="source"
|
||||||
TARGET_BRANCH="master"
|
TARGET_BRANCH="master"
|
||||||
|
BUILD_DIR=".build"
|
||||||
|
|
||||||
# Build front-end assets.
|
# Prepare the build directory.
|
||||||
|
mkdir -p $BUILD_DIR
|
||||||
|
cp -R .git $BUILD_DIR
|
||||||
|
pushd $BUILD_DIR
|
||||||
|
git checkout $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
|
||||||
|
rm -r **/* || exit 0
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Re-generate the site.
|
||||||
npm run prod
|
npm run prod
|
||||||
|
|
||||||
git config --local user.email "oliver@oliverdavies.uk"
|
|
||||||
|
|
||||||
vendor/bin/sculpin generate --no-interaction --clean --env=${SITE_ENV}
|
vendor/bin/sculpin generate --no-interaction --clean --env=${SITE_ENV}
|
||||||
touch output_${SITE_ENV}/.nojekyll
|
touch output_${SITE_ENV}/.nojekyll
|
||||||
|
|
||||||
# Add, commit and push the changes.
|
# Add, commit and push the changes.
|
||||||
cd output_${SITE_ENV}
|
mv output_${SITE_ENV}/* $BUILD_DIR
|
||||||
cp -R ../.git .
|
pushd $BUILD_DIR
|
||||||
git checkout -f $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
|
|
||||||
git add --all .
|
git add --all .
|
||||||
git commit -m "Re-generate site. $SHA"
|
git commit -m "Re-generate site: $SHA"
|
||||||
git push $SSH_REPO $TARGET_BRANCH
|
git push $SSH_REPO $TARGET_BRANCH
|
||||||
|
popd
|
||||||
|
|
||||||
|
rm -rf $BUILD_DIR
|
||||||
|
|
Loading…
Reference in a new issue