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

Commit ff93c20

Browse files
committed
Only deploy from master
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.
1 parent 0ec8126 commit ff93c20

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

build.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@ main() {
1515
fi
1616
fi
1717

18-
# build
19-
build
20-
2118
if [ $_deploy = true ]; then
2219
deploy
2320
else
21+
build
2422
echo ""
2523
echo -e "\033[0;32m Site built, you can serve locally by cd'ing into site/ and running 'hugo serve'...\033[0m"
2624
fi
@@ -46,6 +44,15 @@ deploy() {
4644
echo -e "\033[0;32m Deploying site to GitHub...\033[0m"
4745
cd $root
4846

47+
local branch=$(git rev-parse --abbrev-ref HEAD)
48+
49+
if [ $branch != "master" ]; then
50+
echo "Not on master branch, must be on master to deploy"
51+
return 1
52+
fi
53+
54+
build
55+
4956
# Commit changes.
5057
cd site/public
5158
git add -A

0 commit comments

Comments
 (0)