Reputation: 10630
what can i add to my .travis.yml
to run heroku client commands?
e.g. before deploy:
$ heroku maintenance:on
$ heroku pgbackups:capture --expire
and after deploy:
$ heroku maintenance:on
i've tried adding those commands to before_deploy
in .travis.yml
, but it doesn't have access to the heroku cli tool.
bonus points if i can do this on the app level, e.g. do backups on the production branch, but not staging.
Upvotes: 2
Views: 981
Reputation: 15504
I just installed Heroku toolbelt in a build container. That's how it looks in my build:
sudo: required
before_script:
# this install.sh script requires sudo
- wget -qO- https://toolbelt.heroku.com/install.sh | sh
script:
- /usr/local/heroku/bin/heroku restart --app my-heroku-app-name # requires HEROKU_API_KEY env variable
Note: installing Heroku requires sudo privilege (sudo: required
) and if you have to access your app - $HEROKU_API_KEY
environment variable must be set.
Upvotes: 1
Reputation: 2663
You might be able to everything you need with the Heroku deployment support available on Travis CI.
If you need to do more, you need to install Heroku toolbelt, and figure out how to do what you want.
Upvotes: 0