Skip to content

Commit a301eb5

Browse files
committed
feat: add release:bump task for automated version management
Adds rake release:bump[level] task that uses gem-release to bump version, commit, tag, and push automatically. Splits version bumping from changelog generation for better workflow separation.
1 parent f117f1a commit a301eb5

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

Rakefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,27 @@ end
1616
task default: %i[test standard]
1717

1818
namespace :release do
19+
desc "Bump version (major|minor|patch|pre) and commit"
20+
task :bump, [:level] do |_t, args|
21+
level = args[:level] || "patch"
22+
valid_levels = %w[major minor patch pre]
23+
24+
unless valid_levels.include?(level)
25+
abort "Invalid level: #{level}. Use: #{valid_levels.join(", ")}"
26+
end
27+
28+
branch = `git rev-parse --abbrev-ref HEAD`.strip
29+
unless ["main", "master"].include?(branch)
30+
abort "Version bump must run on main or master. Current: #{branch}."
31+
end
32+
33+
unless system("git diff --quiet") && system("git diff --cached --quiet")
34+
abort "Version bump requires a clean working tree."
35+
end
36+
37+
sh "bundle exec gem bump --version #{level} --commit --tag --push"
38+
end
39+
1940
desc "Update changelog, commit, and tag"
2041
task :prep do
2142
version = GitMarkdown::VERSION

0 commit comments

Comments
 (0)