Example of integration an ruby app with Travis
This repo assume you already have an heroku account and an app running on it.
If not you can do it here
Basically, when you push something on master, it trigger travis and travis make all the things you tell him, (in the .travis.yml) and after run the test etc.. it deploy automatically on your app located on heroku.
Explanation of the travis file
deploy:
provider: heroku # you don't need to change anything here
app: # here you specify the name of your app
api_key:
secure: # you need to execute the command below to generate a token
run:
- rake db:migrate # excute the migration
Before anything make sure you have installed Heroku cli and Travis cli
- Duplicate the .travis.example.yml and remove the example from one
- Now open
.travis.yml
- In the travis file you need to specify the name of your app
deploy:
provider: heroku # you don't need to change anything here
app: # here you specify the name of your app
api_key:
secure: # you need to execute the command below to generate a token
run:
- rake db:migrate # excute the migration
- execute this command in the terminal to get a token from heroku (in the root of the repo)
travis encrypt $(heroku auth:token) --add deploy.api_key
- Thats it ! Now every time you push on master if the build is passing the code will be deployed