Skip to content
This repository has been archived by the owner on Oct 27, 2023. It is now read-only.

Commit

Permalink
Only deploy from master
Browse files Browse the repository at this point in the history
So that devs don't accidentally deploy change the `build.sh` script to
check that we are on the master branch before building and deploying the
site to github pages.
  • Loading branch information
tcharding committed Feb 24, 2023
1 parent 0ec8126 commit ff93c20
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ main() {
fi
fi

# build
build

if [ $_deploy = true ]; then
deploy
else
build
echo ""
echo -e "\033[0;32m Site built, you can serve locally by cd'ing into site/ and running 'hugo serve'...\033[0m"
fi
Expand All @@ -46,6 +44,15 @@ deploy() {
echo -e "\033[0;32m Deploying site to GitHub...\033[0m"
cd $root

local branch=$(git rev-parse --abbrev-ref HEAD)

if [ $branch != "master" ]; then
echo "Not on master branch, must be on master to deploy"
return 1
fi

build

# Commit changes.
cd site/public
git add -A
Expand Down

0 comments on commit ff93c20

Please sign in to comment.