autorelease
v1.7.1
Published
Automatically release NPM packages based on commit messages.
Downloads
211
Maintainers
Readme
Autorelease
This is a tool to facilitate the releasing of NPM packages based on Git commit messages. This tool is designed to handled all aspects of publishing Node modules, including:
- Release verification to ensure the environment is configured correctly before publishing.
- Bumping package versions using semver according to commit types.
- Generating changelogs from commit messages.
- Tagging the commit in Git with the new version.
This is tool is highly configurable and can be adapted using plugins for almost any environment.
This is very similar to semantic-release, but it is much less opinionated. By default, this library does not assume you are using any specific remote git repository host or continuous integration platform. You can configure this tool to work with the environment of your choosing.
Install
Install using NPM:
npm i autorelease --save-dev
You can also easily setup your package for Github or Gitlab using the autorelease-setup
cli. That will take you through a series of prompts and install the correct autorelease packages, including plugins.
npm i autorelease-setup -g
autorelease-setup
Basic Usage
This CLI tool is split into two parts, a before release (pre) stage and an after release (post) stage, each with a series of steps. The before release sets up the repository for release, including release verification, bumping the version number and configuring NPM. The after release stage handles changelog generation and git tagging. The steps in these stages can be configured using the .autoreleaserc
file.
To release a module using this tool, add the following to you package.json
after installing.
{
"scripts": {
"autorelease": "autorelease pre && npm publish && autorelease post"
}
}
You will also need to generate an NPM token, either by using npm login
or with a package like get-npm-token
. Set the token to the NPM_TOKEN
environment variable.
export NPM_TOKEN=XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
Now you can release your package from the command line with:
npm run autorelease
Plugins
There are currently a handful of plugins for Autorelease to configure it for common environments.
- autorelease-github - Publish changelog and tag version using Github releases.
- autorelease-travis - Only allows releases in a Travis CI environment.
- autorelease-gitlab - Only allows releases in a Gitlab CI environment. Also publishes changelog using Gitlab tags.
- autorelease-gemfury - Configures the package for a Gemfury release.