Skip to content

mcfly-io/mcfly-semantic-release

Repository files navigation

mcfly-semantic-release

NPM version Downloads
Build Status Coverage percentage
Dependency Status Dependency Dev Status

NPM

Installation

npm i --save-dev mcfly-semantic-release

Usage

In your package.json

"scripts": {
  "release": "mcfly-semantic-release"
}

Running release will do the following:

  • Bumps version. By default, this will publish a patch version, if you want to control the semver option you can pass an optional type --type argument. The prerelease versions will be in the format of 2.3.2-4. valid types are: 'major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease'
  • Updates version in files: by default it will only update the root level package.json. Optionnaly use --file to specify file paths or files patterns (globs) that can have their version updated as well. Files can be package.json files or config.xml files
  • Commit the changed files with a standard commit message. Default message is chore(app): Version <version number>. Use --production to suffix the commit message with the work production (can be later used in CI)
  • Generates changlog based on Angular standard commit messages.
  • Generate a tag with the version number.
  • Generates a github release with the version number.
"scripts": {
  "release": "mcfly-semantic-release.js --files ./package.json ./bower.json ./config.xml ./projects/**/package.json"
}

NOTE
the path for the --files option is relative to your current root directory

Then, to publish a new version execute the following command:

npm run release

Example :

npm run release -- --type=minor

NOTE
The double -- is necessary, this is how npm script propagates its arguments

Alternate github authentication methods

By default mcfly-semantic-release uses basic username & password auth to communicate with github. Whem it runs, you will be prompted for your github username and password before the release will run. If your username for github is available in your git config, mcfly-semantic-release will find it and not prompt you to enter it.

As an alternative to basic auth, you can provide an oauth token (see github oauth). To use a token, make sure it is valid and has the correct scopes for the repo and then pass it as $GITHUB_TOKEN. Then, when prompted for your password, just leave it blank and hit enter and the token will be used for the authentication!

~/dev/mcfly-io/mcfly-semantic-release $> GITHUB_TOKEN=<oauth_token> npm run release

> [email protected] release /Users/marty/dev/mcfly-io/mcfly-semantic-release
> node bin/mcfly-semantic-release.js

Hello [email protected], let's publish a new version...
? Please enter your GitHub password (leave blank to use $GITHUB_TOKEN)
Github authentication...
Generating changelog...
Bumping files...
Committing version...
Publishing version...
Release v1.0.16 successfully published!

About

A cli tool to bump version and publish to github

Resources

Stars

Watchers

Forks

Packages

No packages published