Skip to content

Instantly share code, notes, and snippets.

@darth-veitcher
Last active December 28, 2016 21:58
Show Gist options
  • Save darth-veitcher/2db53dd6caed63b4d0edaab235210b9c to your computer and use it in GitHub Desktop.
Save darth-veitcher/2db53dd6caed63b4d0edaab235210b9c to your computer and use it in GitHub Desktop.
Ghost build script
#!/bin/sh
site='jamesveitch.com'
branch=$(git branch | awk '/\*/ {print $2}') # get the current branch
buster generate
# Remove static folder but ensure we delete stale files and keep the key
# CNAME and build-site.sh files
rsync -rLvP static/* . --delete-after --remove-source-files --exclude CNAME --exclude build-site.sh
rm -rf static
# Edit the robots.txt (seems to keep localhost)
sed -i '' "s|localhost|$site|g" robots.txt
sed -i '' "s|http:|https:|g" robots.txt
# Now commit
git add .
git commit -m "Update on the website at $(date)"
git push origin $branch # don't use origin master as we might be on another branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment