npm i --save-dev mcfly-semantic-release
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 of2.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 bepackage.json
files orconfig.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 workproduction
(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
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
> mcfly-semantic-release@1.0.15 release /Users/marty/dev/mcfly-io/mcfly-semantic-release
> node bin/mcfly-semantic-release.js
Hello marty@mcfly.io, 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!