Add automatically releasing to Github project

semantic-release

  1. npm i -g semantic-release cli

  2. semantic-release-cli setup

    • it will add travis.yml to the project
    • package.json changes
      • version is removed
      • add semantic-release task
      • add semantic-release to devDependencies

commitizen

Since semantic-release uses conventional commit message to determine version, this tool will make it easier.

  1. npm install -D commitizen cz-conventional-changelog
    • add commitizen & cz-conventional-changelog to package.json
  2. run commitizen init cz-conventional-changelog --save-dev --save-exact
  3. add task "commit": "git-cz" to package.json

TravisCI

The .travis.yml should probably look like

.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
sudo: false
language: node_js
cache:
directories:
- node_modules
branches:
only:
- master
notifications:
email: false
node_js:
- '4'
before_install:
- npm i -g npm@^2.0.0
before_script:
- npm prune
script:
- npm run build
after_success:
- npm run semantic-release