javascript - tools - semantic-release


semantic-release -

semantic-release -

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 -

  • install semantic-release package as devDepencencies

npm i --save-dev semantic-release

  • install globally the semantic-release CLI to ease the configuration

semantic-release/cli -

npm i -g semantic-release-cli

Execute the CLI with semantic-release-cli setup and answer the questions.



Using semantic-release with Travis CI -

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 example

language: node_js

    - 10

cache: npm

    - npm ci

    - npm run test

        - '/^v\d+\.\d+\.\d+$/'

        - stage: test
              - npm run test
        - stage: deploy
          if: branch == master && !fork
          node_js: '10'
              - 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.

continuous delivery workflow

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.

results for ""

    No results matching ""