ci(travis): include commitlint stage

* https://github.com/conventional-changelog/commitlint
  - Lint commit messages.
  - Ensure that they are in accordance with `semantic-release` settings.
  - Use Travis CI to display errors and prevent release stage if so.
* https://conventional-changelog.github.io/commitlint/#/reference-rules
  - Specific rules are defined in `commitlint.config.js`.
  - Using the default rules at the time of this commit.
  - This link gives full details on the default values and how to
    provide custom settings.
This commit is contained in:
Imran Iqbal 2019-02-21 08:18:40 +00:00
parent 8fca3a9e32
commit 6659a695d1
2 changed files with 18 additions and 2 deletions

View file

@ -1,3 +1,9 @@
stages:
- test
- commitlint
- name: release
if: branch = master
sudo: required
cache: bundler
language: ruby
@ -22,9 +28,16 @@ before_deploy:
- test $TRAVIS_TEST_RESULT = 0
jobs:
# Only run if this is the `master` branch
if: branch = master
include:
# Define the commitlint stage
- stage: commitlint
language: node_js
node_js: lts/*
before_install: skip
script:
- npm install @commitlint/config-conventional -D
- npm install @commitlint/travis-cli -D
- commitlint-travis
# Define the release stage that runs semantic-release
- stage: release
language: node_js

3
commitlint.config.js Normal file
View file

@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
};