I set up a deployment job for a Hugo Blog on GitHub Pages, the code itself is stored in dev branch while the static files that are the rendered blog are stored in master branch.
Therefore I created a YAML .travis.yml file that renders everything into public/ and deploys it to master. The relevant part of the .travis.yml looks like this:
branches:
only:
- dev
except:
- master
deploy:
github_token: $GITHUB_TOKEN
provider: pages
target_branch: master
skip_cleanup: true
local_dir: public
on:
branch: dev
This works perfect. Whenever I push code to dev the script is ran and the static website is being rendered and generated to public/, but for some reason, this also creates an automatic build job, created and started by Deployment Bot (from Travis CI).
I don't have a .travis.yml file in master branch so Travis obviously complaints about this, stating:
Could not find .travis.yml, using standard configuration.
and later on fails after executing rake:
$ rake
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/home/travis/.rvm/gems/ruby-2.4.1@global/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/home/travis/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `eval'
/home/travis/.rvm/gems/ruby-2.4.1/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)
The command "rake" exited with 1.
I understand why this job fails. The problem is that this job should have never run in first place. There is no reason to run any CI job on the static files, which are the result of the original intended CI job.
How can I make Travis stop building this job automatically after deploy? Travis does not ignore builds on master branch although it is listed under branches: except in the YAML file.