Skip to content

Commit

Permalink
Merge pull request #18007 from simaishi/update_gemfile_for_tag
Browse files Browse the repository at this point in the history
Lock Gemfile to tag reference for release builds

(cherry picked from commit e0d7468)
  • Loading branch information
Fryguy authored and simaishi committed Oct 1, 2018
1 parent e161d8f commit c096f2f
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions lib/tasks/release.rake
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,23 @@ task :release do
version_file = root.join("VERSION")
File.write(version_file, version)

# Create the commit and tag
exit $?.exitstatus unless system("git add #{version_file}")
# Change git based gem source to tag reference in Gemfile
gemfile = root.join("Gemfile")
content = gemfile.read
gemfile.write(content.gsub(":branch => \"#{branch}\"", ":tag => \"#{version}\""))

# Commit
exit $?.exitstatus unless system("git add #{version_file} #{gemfile}")
exit $?.exitstatus unless system("git commit -m 'Release #{version}'")

# Tag
exit $?.exitstatus unless system("git tag #{version}")

# Revert the Gemfile update
gemfile.write(content)
exit $?.exitstatus unless system("git add #{gemfile}")
exit $?.exitstatus unless system("git commit -m 'Revert Gemfile tag reference update and put back branch reference'")

puts
puts "The commit on #{branch} with the tag #{version} has been created"
puts "Run the following to push to the upstream remote:"
Expand Down

0 comments on commit c096f2f

Please sign in to comment.