bin/gempush-if-changed in phonetics-2.0.1 vs bin/gempush-if-changed in phonetics-3.0.1
- old
+ new
@@ -1,8 +1,15 @@
#!/bin/bash
set -x
-if git diff --name-only HEAD..HEAD^ | egrep -q '^VERSION$'; then
- # The VERSION file changed in the last commit, build the gem and push
+
+# 'latest' is a git tag that we recreate every time we release a new
+# version. If the VERSION file has changed since `latest` then we release a
+# new version.
+git pull --tags
+if git diff --name-only HEAD latest -- VERSION | egrep -q .; then
+ # The VERSION file changed since 'latest', build the gem and push
gem build *.gemspec
gem push *.gem
+ git tag -f latest HEAD
+ git push origin latest
fi