Yes, you can, but then you’ll need to somehow transfer build artifacts into the machine running the dedicated deployment job – e.g. via a workspace. In most cases, this is unnecessary complication.
skip_cleanup:
is invalid outside of a deploy:
entry and will be ignored in the 2nd example.
Check this for an overview of Travis’ build process: