semantic-release - semantic-release.gitbook.io
semantic-release automates the whole package release workflow including: determining the next version number, generating the release notes and publishing the package.
This removes the immediate connection between human emotions and version numbers, strictly following the Semantic Versioning specification.
Installation - semantic-release.gitbook.io
npm i --save-dev semantic-release
semantic-release/cli - github.com
npm i -g semantic-release-cli
Execute the CLI with semantic-release-cli setup
and answer the questions.
Using semantic-release with Travis CI - github.com/semantic-release
When semantic-release-cli is run to setup, it configures automatically the github repository.
Just needs after to create a .travis.yml
configuration file.
.travis.yml
examplelanguage: node_js
node_js:
- 10
cache: npm
install:
- npm ci
script:
- npm run test
branches:
except:
- '/^v\d+\.\d+\.\d+$/'
jobs:
include:
- stage: test
script:
- npm run test
- stage: deploy
if: branch == master && !fork
node_js: '10'
script:
- npm install -g [email protected]^15
- semantic-release
This config will run against [email protected]
, install deps and run tests.
If the destination branch is master
and is not a fork, semantic-release will be also triggered.
By default semantic-release used with a single master
branch will output to a continuous deployment workflow.
As soon as something is merged in master
, it will trigger the deploy stage.
Using a continuous delivery workflow gives more control over what is released in production.
Just add a develop
branch, set this branch as default to be the destination for PR.
When you want to deploy, just merge locally your develop
into master
, a build will be triggered with the release stage active.
Don't use PR to merge develop
into master
, release stage is disabled for PR. This limitation is builtin.