Skip to content

Commit 063ce4d

Browse files
committed
Make it easier to release a new version
1 parent 61598df commit 063ce4d

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ To install this gem onto your local machine, run `bundle exec rake install`.
6363

6464
To release a new version, update the version number in `version.rb`, in a commit or pull request.
6565

66-
Create and push a new git tag:
66+
Create and push a new signed git tag, the `git:tag` rake task will use the version from `version.rb`.
6767

6868
```shell
69-
git tag -m "Version <VERSION>" v<VERSION>
69+
rake git:tag
7070
git push --tags
7171
```
7272

Rakefile

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# frozen_string_literal: true
22

3-
require "bundler/gem_tasks"
3+
require "bundler/setup"
44
require "rspec/core/rake_task"
55
require "rubocop/rake_task"
66

7+
require_relative "lib/rubocop/eightyfourcodes/version"
8+
79
RuboCop::RakeTask.new
810

911
task default: %i[spec rubocop]
@@ -30,3 +32,15 @@ task :new_cop, [:cop] do |_task, args|
3032

3133
puts generator.todo
3234
end
35+
36+
namespace :git do
37+
version = RuboCop::EightyFourCodes::VERSION
38+
tag = "v#{version}"
39+
40+
desc "Create a signed git tag named: #{tag}"
41+
task :tag do
42+
command = %(git tag --sign --message="Version #{version}" #{tag})
43+
44+
system(command, exception: true)
45+
end
46+
end

0 commit comments

Comments
 (0)