Do not deploy to Maven on stable branches

Change-Id: I1f518d2467860b9cb9d0d4f4fda7c1e120014cf7
diff --git a/jenkins/gerrit-deploy-api.sh b/jenkins/gerrit-deploy-api.sh
index 2af1659..b1eb25f 100644
--- a/jenkins/gerrit-deploy-api.sh
+++ b/jenkins/gerrit-deploy-api.sh
@@ -1,5 +1,11 @@
 #!/bin/bash -e
 
+VERSION=$(([ -f VERSION ] && cat VERSION) || ([ -f version.bzl ] && cat version.bzl) | grep VERSION)
+if expr $VERSION : '.*SNAPSHOT.*'
+then
+  exit 0
+fi
+
 if [ -f ~/.m2/settings.xml ]
 then
   if grep -q sonatype-nexus-staging ~/.m2/settings.xml