diff --git a/.github/workflows/mswin-snapshot.yml b/.github/workflows/mswin-snapshot.yml index 411e7c4..7560326 100644 --- a/.github/workflows/mswin-snapshot.yml +++ b/.github/workflows/mswin-snapshot.yml @@ -41,7 +41,7 @@ jobs: run: | set -x sudo apt-get update -q || : - sudo apt-get install --no-install-recommends -y ruby bundler + sudo apt-get install --no-install-recommends -y ruby bundler zip unzip - name: Checkout ${{ github.repository }} # A branch dispatched before it is merged has to index with its @@ -68,6 +68,26 @@ jobs: aws s3 cp "$zip.sha256" "s3://ftp.r-l.o/$dev/$name.sha256" --no-progress done + - name: Upload ruby-head + # ruby-head-.zip is a stable URL for the newest dev + # build, which setup-ruby installs as `mswin`. The zip root has to + # match the file name, so the package is repacked under the new + # name rather than copied, and the overwritten object is purged. + run: | + set -ex + dev=pub/ruby/binaries/mswin64/dev + for zip in pkg/*.zip; do + pkg=$(basename "$zip" .zip) + head=ruby-head-$(echo "$pkg" | cut -d- -f5-) + rm -rf repack "$head.zip" + mkdir repack + unzip -q "$zip" -d repack + mv "repack/$pkg" "repack/$head" + (cd repack && zip -qrX "../$head.zip" "$head") + aws s3 cp "$head.zip" "s3://ftp.r-l.o/$dev/$head.zip" --no-progress --metadata signed=false + curl -sS -X PURGE -H "Fastly-Soft-Purge:1" "https://cache.ruby-lang.org/$dev/$head.zip" + done + - name: Prune old dev builds # Keep the newest 30 dev builds of each platform. Listing goes # through list-objects-v2 rather than `aws s3 ls`, whose diff --git a/tool/update_binaries_index.rb b/tool/update_binaries_index.rb index 0400595..9eabf54 100644 --- a/tool/update_binaries_index.rb +++ b/tool/update_binaries_index.rb @@ -88,6 +88,8 @@ def scan_builds(bucket) builds = [] bucket.objects(prefix: PREFIX).each do |obj| next unless obj.key.end_with?('.zip') + # A repacked copy of the newest dev build under a stable URL, see mswin-snapshot.yml + next if obj.key.match?(%r{\A#{PREFIX}dev/ruby-head-#{PLATFORM}\.zip\z}o) basename = File.basename(obj.key) common = { name: basename.delete_suffix('.zip'),