diff --git a/lib/release/create.rb b/lib/release/create.rb index 8c24a09..3925cd8 100644 --- a/lib/release/create.rb +++ b/lib/release/create.rb @@ -21,8 +21,11 @@ module Release validate_version_is_new version + update_package_json version + git_local_tag release_tag_from_version(version) + git_push current_branch git_push_tags end diff --git a/lib/release/finish.rb b/lib/release/finish.rb index 519955f..0f0eedc 100644 --- a/lib/release/finish.rb +++ b/lib/release/finish.rb @@ -18,10 +18,11 @@ module Release git_pull release_branch + update_package_json version_from_release_branch(release_branch) + git_local_tag release_tag_from_version(version_from_release_branch(release_branch)) git_push release_branch - git_push_tags git_checkout "master" diff --git a/lib/shared/runnable.rb b/lib/shared/runnable.rb index 1ea7593..d75f84e 100644 --- a/lib/shared/runnable.rb +++ b/lib/shared/runnable.rb @@ -1,3 +1,5 @@ +require 'json' + module Shared module Runnable @@ -19,6 +21,25 @@ module Shared exit end + def update_package_json (version) + if File.exist? 'package.json' + package_json = File.read('package.json') + json = JSON.parse(package_json) + json['version'] = version + File.write('package.json', JSON.pretty_generate(json)) + git_add 'package.json' + git_commit version + end + end + + def git_add (path) + run_cmd "git add #{path}" + end + + def git_commit (msg) + run_cmd "git commit -m '#{msg}'" + end + def git_show_branches run_cmd "git branch" end