title: Call GitHub API with Travis to build Tag
body: <p>I have created a TravisCI Hook in a GitHub repository that automatically run a build after pushing to the repo. What I would like to add is that if the build succeeds a tag is automatically created.</p>
  
  <p>I have found out that there is a way to create tags with the GitHub API <a href="http://developer.github.com/v3/git/tags/#create-a-tag-object">http://developer.github.com/v3/git/tags/#create-a-tag-object</a></p>
  
  <p>But how do I control access to my repository? I can't expose my login github credentials in the travis.yml because everyone can read it as it is cointained in the repository.\</p>
  
  <p>I am pretty new to automated deployment so if there is any other solution to do this without travis please let me also know. What I would like to achieve is that a downloadable version is created for the users after a successful build.</p>
  
  <h3>Solution</h3>
  
  <p>Ok I have finally found the correct travis.yaml Configuration.</p>
  
  <p>How does it work:
  After pushing to the repository, travis will run the tests of my application. If the tests are successful travis will build a precompiled version of the current build and upload it to a special release which I have created on the GitHub Repo.</p>
  
  <pre><code>    language: scala
      env:
        global:
          - PLAY_VERSION=2.2.1
          - secure: "HD1x0S9ad/3+G9YUkyT/uTw9lEr+tUQEV4QO+M2Ro1JFSVOzLNZiNoh6FrNb06a0TbencTkftyHYmYjp1/CCyTpF9CMCQ4ddB7TVF9hibH1y9ONVrPJIm5BCEpjGDa4fND8bkcChrpcZDQKIO0ZwArEsl2+IRocnbBT+oYqIFNo="
      before_script:
        - wget http://downloads.typesafe.com/play/${PLAY_VERSION}/play-${PLAY_VERSION}.zip
        - unzip -q play-${PLAY_VERSION}.zip
        - sudo apt-get install jq
      script: play-${PLAY_VERSION}/play test
      notifications:
        email: false
      after_success: 
        - play-${PLAY_VERSION}/play dist
        - cd target/universal/
        - 'ASSETID=$(curl -s -H "Authorization: token ${BUILD_KEY}" "https://api.github.com/repos/meisign/fillable/releases/204198/assets" | jq ".[0].id")'
        - 'curl -XDELETE -s -H "Authorization: token ${BUILD_KEY}" "https://api.github.com/repos/meisign/fillable/releases/assets/$ASSETID"'
        - 'curl -XPOST -s -H "Authorization: token ${BUILD_KEY}" -H "Content-Type: application/zip" --data-binary @./Fillable-1.0-SNAPSHOT.zip "https://uploads.github.com/repos/meisign/fillable/releases/204198/assets?name=Fillable.zip"'
  </code></pre>