travis: extract script code

Because we can't use "&" in YAML.