Fix order of build lifecycle steps.

Fixes travis-ci/travis-ci#2643