SemanticRelease
This gem helps you to manage the version number of your application or library.
Use the provided Rake tasks to:
- bump the major, minor, or patch number of your version
- automatically update your version file (e.g.
lib/version.rb) - automatically update your changelog (
CHANGELOG.mdorhistory.rdoc) - automatically create a git commit and tag for the release
This gem was inspired by:
- SemVer2 (https://github.com/haf/semver)
- Rake-n-Bake (https://github.com/RichardVickerstaff/rake-n-bake)
- Version Manager (https://github.com/tpbowden/version_manager)
Installation
Install the gem and add to the application's Gemfile by executing:
bundle add semantic_releaseIf bundler is not being used to manage dependencies, install the gem by executing:
gem install semantic_releaseUsage
Add the Rake task by adding the following lines to a Rake configuration file (e.g. Rakefile or lib/tasks/default.rake):
require "semantic_release/rake_task"
SemanticRelease::RakeTask.newThe name of the rake task and other options are configurable like so:
require "semantic_release/rake_task"
SemanticRelease::RakeTask.new(:semver) do |config|
config.semver_file = "semver.json"
config.disable_rubygems_message = true
endThe following tasks are available:
rake release:init
rake release:current
rake release:major
rake release:minor
rake release:patch
To get the current version inside your application:
SemanticRelease.current_versionDevelopment
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install.
To release a new version, run bundle exec rake semver:XXX (replacing XXX with major or minor or patch), which will bump the version number and create a git tag for the version. Then run git push origin main --tags to push the new tag.
Then run bundle exec rake release, which will build and push the .gem file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/ukdave/semantic_release.
License
The gem is available as open source under the terms of the MIT License.