سؤال

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.

هل كانت مفيدة؟

المحلول

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.

نصائح أخرى

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top