restrict travis builds to main and release branches (#11349)

diff --git a/.travis.yml b/.travis.yml
index 2fbc7d6..b0accff 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,6 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+branches:
+  only:
+  - master
+  - /^\d+\.\d+\.\d+(-\S*)?$/ # release branches
+
 language: java
 
 dist: xenial