Run publish when I commit

Now when we commit, we try to publish when it’s on master branch,
otherwise just try the build.

Other owners will add to add their own secure encrypted key:

    GH_USERNAME=YOUR_GITHUB_USERNAME
    GH_BRANCH=gh-pages

    curl -u $GH_USERNAME -d
"{\"scopes\":[\"public_repo\"],\"note\":\"push to $GH_BRANCH from
travis\"}" https://api.github.com/authorizations

You will be asked to enter your password.

Then you will have something like this

    {
      "id": 123456,
      "url": "https://api.github.com/authorizations/8955171",
      "app": {
        "name": "push to gh-pages from travis (API)",
        "url": "https://developer.github.com/v3/oauth_authorizations/",
        "client_id": "00000000000000000000"
      },
      "token": "YOUR_AWESOME_TOKEN",
      "note": "push to gh-pages from travis",
      "note_url": null,
      "created_at": "2014-05-29T03:55:28Z",
      "updated_at": "2014-05-29T03:55:28Z",
      "scopes": [
        "public_repo"
      ]
    }

Now you will need travis encrypt command that you can get with the ruby
gem `travis` (that have an `encrypt` command) or the npm package
`travis-encrypt`.
For the commands below, lines prefixed by # are for ruby gem, the
following line will be npm version (since I’ve used this one, I’m sure
it as worked - I will see after this commit :D)

    #gem install travis
    npm i -g travis-encrypt

Then continue with (replace YOUR_AWESOME_TOKEN by your actual token)

    GH_REPOSITORY="putaindecode/website"
    GH_TOKEN=YOUR_AWESOME_TOKEN
    #travis encrypt -r $GH_REPOSITORY GH_TOKEN=$GH_TOKEN
    travis-encrypt -r $GH_REPOSITORY -k GH_TOKEN -v $GH_TOKEN

You will get a travis specific token that you should now add in the
env.global section (with your nick please).

---

Cette PR est un bon example. [Le build lié](https://travis-ci.org/putaindecode/website/builds/26275338) nous montre bien que `npm run travis` n'a que joué le build, sans faire le publish.
Maintenant on va merger et voir si ça publish bien :)

![](http://www.reactiongifs.com/wp-content/uploads/2012/11/fingers-crossed.gif)