Skip to content

Commit

Permalink
Add push task to push built gems
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 15, 2022
1 parent 14ec9bc commit 4431eef
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions rakelib/release.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
release_task = Rake.application["release"]
release_task.prerequisites.delete("build")
release_task.prerequisites.delete("release:rubygem_push")
release_task_comment = release_task.comment
if release_task_comment
release_task.clear_comments
release_task.comment = release_task_comment.gsub(/ and build.*$/, "")
end

desc "Push built gems"
task "push" do
require "open-uri"
helper = Bundler::GemHelper.instance
gemspec = helper.gemspec
name = gemspec.name
version = gemspec.version.to_s
pkg_dir = "pkg"
mkdir_p(pkg_dir)
["", "-java"].each do |type|
base_url = "https://github.com/ruby/#{name}/releases/download"
url = URI("#{base_url}/v#{version}/#{name}-#{version}#{type}.gem")
path = "#{pkg_dir}/#{File.basename(url.path)}"
url.open do |input|
File.open(path, "wb") do |output|
IO.copy_stream(input, output)
end
helper.__send__(:rubygem_push, path)
end
end
end

0 comments on commit 4431eef

Please sign in to comment.