Skip to content

Commit 0fb9c9d

Browse files
committed
Do not publish if there is nothing to publish
1 parent 5c39678 commit 0fb9c9d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

publish.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,12 @@ echo "Pushing update"
4040
git config user.name "Travis CI"
4141
git config user.email "[email protected]"
4242
git add -A .
43-
git commit -a -m "Deploy to GitHub Pages"
44-
git push > /dev/null 2>&1
43+
if git diff --staged --quiet; then
44+
echo "Nothing to publish"
45+
else
46+
git diff --quiet git commit -a -m "Deploy to GitHub Pages"
47+
git push > /dev/null 2>&1
48+
echo "Pushed"
49+
fi
4550

46-
echo "Pushed"
4751
popd > /dev/null 2>&1

0 commit comments

Comments
 (0)