Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I trigger travis ci to build my app by creating git tag?

I want to trigger Travis CI to build and deploy when I create tag via github web interface. I can't find information about triggers for Travis CI. So can I do it?

like image 540
Vladimir Starkov Avatar asked Feb 18 '15 18:02

Vladimir Starkov


People also ask

How do you trigger a Travis CI build?

Trigger Travis CI builds using the API V3 by sending a POST request to /repo/{slug|id}/requests : Get an API token from your Travis CI settings page. You'll need the token to authenticate most of these API requests.

Which of the following build automation tool can be used with Travis CI?

Travis CI supports parallel testing. It can also be integrated with tools like Slack, HipChat, Email, etc. and get notifications if the build is unsuccessful. Developers can speed up their test suites by executing multiple builds in parallel, across different virtual machines.


1 Answers

A build should automatically start when a new tag is created. To deploy you have to add the follow bit to the deploy section:

on:
   tags: true

Here is a complete example:

language: php

php:
- 5.3
- 5.4

deploy:
  provider: heroku
  strategy: git
  skip_cleanup: true
  app: myapp
  on:
    tags: true
    php: '5.4'
  api_key:
    secure: NL10DAVFJJPk7mHdKeN3q5hpKgRq/gKpEnsXeBb7dDcnW0XuwmO88srMVbYHOA6w3kw50aPkKZ1AirElPjcpm2uxEz/tW7PpshY8fGDKdCyuczXKh24avTpD8nF8lskTIPXVpwWBYxCoFziRsd+eQBKHCsRyrQcv0mjg2j2MoNE=

Travis CI has a nice documentation about all the possibilities.

like image 57
Odi Avatar answered Sep 22 '22 18:09

Odi