This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/publish.sh

27 lines
657 B
Bash
Raw Normal View History

2017-07-10 22:12:20 +00:00
#!/usr/bin/env bash
2017-07-24 17:15:56 +00:00
set -uex
2017-07-10 22:12:20 +00:00
2017-07-24 17:15:56 +00:00
SITE_ENV="prod"
2017-07-24 16:16:20 +00:00
REPO=`git config remote.origin.url`
SSH_REPO=${REPO/https:\/\/github.com\//git@github.com:}
SHA=`git rev-parse --verify HEAD`
2017-07-24 23:47:00 +00:00
SOURCE_BRANCH="source"
2017-07-24 18:23:40 +00:00
TARGET_BRANCH="master"
2017-07-24 16:16:20 +00:00
2017-07-14 22:16:24 +00:00
# Build front-end assets.
2017-07-20 17:58:25 +00:00
npm run prod
2017-07-14 22:16:24 +00:00
2017-07-25 00:06:30 +00:00
git config --local user.email "oliver@oliverdavies.uk"
2017-07-24 23:47:00 +00:00
2017-07-10 22:12:20 +00:00
vendor/bin/sculpin generate --no-interaction --clean --env=${SITE_ENV}
touch output_${SITE_ENV}/.nojekyll
2017-07-24 19:06:06 +00:00
2017-07-10 22:12:20 +00:00
# Add, commit and push the changes.
2017-07-24 23:47:00 +00:00
cd output_${SITE_ENV}
2017-07-25 00:06:30 +00:00
cp -R ../.git .
2017-07-25 00:30:32 +00:00
git checkout -f $TARGET_BRANCH || git checkout --orphan $TARGET_BRANCH
2017-07-24 23:47:00 +00:00
git add --all .
git commit -m "Re-generate site. $SHA"
2017-07-24 18:23:40 +00:00
git push $SSH_REPO $TARGET_BRANCH