Safer branch builds

- Don't attempt to publish new gem versions for branches (matching ENV added to Jenkins job)
- Attempt to merge against master before running tests, as per recent Whitehall and Rummager changes