Release a new version of your Node-based project
Grunt plugin for automating all the release steps of your node lib or bower component, with optional publishing to npm.
Releasing a new version of your killer Node/Bower/Component/JS lib looks something like this:
- bump the version in your
- stage the package.json file's change.
- commit that change with a message like "release 0.6.22".
- create a new git tag for the release.
- push the changes out to github.
- also push the new tag out to github.
- publish the new version to npm.
Cool, right? No! What's wrong with you? Automate all that:
Done. No more github issues reminding you how often you forget to do one or more of the steps.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-release --save-dev
prerelease will just update the number after
If you want to add an alphanumeric identifier, you will need to add it by hand.
-alpha.0 to get something like
grunt release:prerelease will just update the last number to
promote will update a beta prerelease to stable.
Example: for a version
grunt release:promote will update the version to
Releasing Stable Versions By default, grunt-vtex-release will append the "beta" prerelease tag to all versions. In order to release stable versions, you can:
- Use the
--tag stableoption. e.g.
grunt release:minor --tag stable
- Use the shorcut:
grunt release:minor --stable
To see what grunt-release does, without really changing anything, use
grunt --no-write -v release
You'll see something like:
Parsing package.json...OKNot actually writing package.json...OK>> Version bumped to 0.2.6Not actually running: git add package.jsonNot actually running: git commit package.json -m "release 0.2.6">> package.json committedNot actually running: git tag 0.2.6 -m "version 0.2.6">> New git tag created: 0.2.6Done, without errors.
The following are all the release steps, you can disable any you need to:
release:options:bump: false //default: truefile: 'component.json' //default: package.jsonadd: false //default: truecommit: false //default: truetag: false //default: truepush: false //default: truepushTags: false //default: truenpm: false //default: truenpmtag: true //default: no tagfolder: 'folder/to/publish/to/npm' //default project roottagName: 'some-tag-<%= version %>' //default: '<%= version %>'commitMessage: 'check out my release <%= version %>' //default: 'release <%= version %>'tagMessage: 'tagging version <%= version %>' //default: 'Version <%= version %>',github:repo: 'geddski/grunt-release' //put your user/repo hereusernameVar: 'GITHUB_USERNAME' //ENVIRONMENT VARIABLE that contains Github usernamepasswordVar: 'GITHUB_PASSWORD' //ENVIRONMENT VARIABLE that contains Github password
- Yes, you have to use environment variables. I would be a terrible person if I let you check in your username and password into your source code.
- The Github Releases API is still unstable and may change in the next couple months or so.
- You can use an access token if you'd rather.
For node libs, leave
file option blank as it will default to
package.json. For Bower components, set it to