chore: Attempt to fix the releaser (#2218)
This commit is contained in:
parent
d6d481ec51
commit
4c9181f8dd
9
Rakefile
9
Rakefile
|
@ -74,7 +74,14 @@ def load_env_vars
|
|||
filename = "#{ENV['KOKORO_GFILE_DIR']}/ruby_env_vars.json"
|
||||
raise "#{filename} is not a file" unless File.file? filename
|
||||
env_vars = JSON.parse File.read(filename)
|
||||
env_vars.each { |k, v| ENV[k] ||= v }
|
||||
env_vars.each do |k, v|
|
||||
if ENV[k]
|
||||
puts "Ignoring #{k} because it is already set"
|
||||
else
|
||||
puts "Setting #{k}"
|
||||
end
|
||||
ENV[k] ||= v
|
||||
end
|
||||
end
|
||||
|
||||
def header str, token = "#"
|
||||
|
|
|
@ -37,9 +37,11 @@ class Releaser
|
|||
|
||||
def publish_gem
|
||||
configure_rubygems_api_token
|
||||
bundle_dir do
|
||||
Dir.chdir(gem_dir) do
|
||||
FileUtils.rm_rf("pkg")
|
||||
isolate_bundle do
|
||||
execute "bundle exec rake build"
|
||||
end
|
||||
built_gem_path = "pkg/#{gem_name}-#{gem_version}.gem"
|
||||
raise "Failed to build #{built_gem_path}" unless File.file?(built_gem_path)
|
||||
if dry_run?
|
||||
|
@ -53,10 +55,12 @@ class Releaser
|
|||
end
|
||||
|
||||
def publish_docs
|
||||
bundle_dir do
|
||||
Dir.chdir(gem_dir) do
|
||||
FileUtils.rm_rf("doc")
|
||||
FileUtils.rm_rf(".yardoc")
|
||||
isolate_bundle do
|
||||
execute "bundle exec rake yard"
|
||||
end
|
||||
Dir.chdir("doc") do
|
||||
execute "python3 -m docuploader create-metadata" \
|
||||
" --name #{gem_name}" \
|
||||
|
@ -117,16 +121,16 @@ class Releaser
|
|||
Gems.configure do |config|
|
||||
config.key = rubygems_api_token
|
||||
end
|
||||
puts "Configured rubygems api token"
|
||||
end
|
||||
end
|
||||
|
||||
def bundle_dir
|
||||
def isolate_bundle
|
||||
block = proc do
|
||||
execute "bundle update" unless @bundle_updated
|
||||
@bundle_updated = true
|
||||
yield
|
||||
end
|
||||
Dir.chdir(gem_dir) do
|
||||
if defined?(Bundler)
|
||||
if Bundler.respond_to?(:with_unbundled_env)
|
||||
Bundler.with_unbundled_env(&block)
|
||||
|
@ -137,7 +141,6 @@ class Releaser
|
|||
block.call
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def execute(cmd)
|
||||
puts cmd
|
||||
|
|
Loading…
Reference in New Issue