Skip to content

Commit

Permalink
Add script to automate releases more easily.
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerluan committed Jul 7, 2022
1 parent fdf98b9 commit 7c2bf5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ gem "rubocop"
gem "rubocop-rake"
gem "rubocop-rspec"
gem "simplecov", require: false, group: :test
gem "tty-prompt"
15 changes: 15 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "tty-prompt"

RSpec::Core::RakeTask.new(:spec)

Expand All @@ -19,3 +20,17 @@ task :test_swift do
end
FileUtils.rm_rf("tests")
end

desc "Sets lib version to the semantic version given, and push it to remote."
task :bump, [:v] do |t, args|
version = args[:v] || raise("A version is required. Pass it like `rake bump[1.2.3]`")
next unless TTY::Prompt.new.yes?("Would you like to set the new version of the app to be '#{version}'?")
version_filename = "lib/arkana/version.rb"
version_file_contents = File.read(version_filename)
new_version_file_contents = version_file_contents.gsub(/VERSION = \"(?:.*)\"/, "VERSION = \"#{version}\"")
File.open(version_filename, "w") {|file| file.puts new_version_file_contents }
sh("bundle install")
sh("git add #{version_filename} Gemfile.lock")
sh("git commit -m 'Bump app version to v#{version}.'")
sh("git push origin")
end

0 comments on commit 7c2bf5c

Please sign in to comment.