Skip to content

Commit

Permalink
Don't use releases.yml when release time.
Browse files Browse the repository at this point in the history
https://github.com/ruby/docker-images/actions/runs/11591149300/job/32270268536#step:5:3268

We can't look releases.yml at that time. we should refer tar file directly.
  • Loading branch information
hsbt committed Oct 31, 2024
1 parent a3b2252 commit 2658e63
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions install_ruby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,17 @@ RUBYGEMS_VERSION=${RUBYGEMS_VERSION-3.2.3}
PREFIX=${PREFIX-/usr/local}

function get_released_ruby() {
git clone --depth 1 https://github.com/ruby/www.ruby-lang.org.git /tmp/www

cat << RUBY | ruby - $1 /tmp/www/_data/releases.yml
require "psych"
version = ARGV[0]
if Psych.respond_to?(:safe_load_file)
require "date"
releases = Psych.safe_load_file(ARGV[1], permitted_classes: [Symbol, Date])
cat << RUBY | ruby - $1
require "net/http"
require "uri"
ver2 = ARGV[0].split('.')[0,2].join('.')
if Net::HTTP.get_response(URI.parse("https://cache.ruby-lang.org/pub/ruby/#{ver2}/ruby-#{ARGV[0]}.tar.gz")).code == "200"
url = "https://cache.ruby-lang.org/pub/ruby/#{ver2}/ruby-#{ARGV[0]}.tar.gz"
sha256 = `curl -sSL #{url} | sha256sum`.split(' ')[0]
puts "#{url} #{sha256}"
else
releases = Psych.load_file(ARGV[1])
end
release = releases.find {|x| x["version"] == version }
puts "#{release["url"]["xz"]} #{release["sha256"]["xz"]}"
exit 1
RUBY
rm -rf /tmp/www
}

case $RUBY_VERSION in
Expand Down

0 comments on commit 2658e63

Please sign in to comment.