Skip to content

Commit 1150703

Browse files
committed
Attach source during build to the release
1 parent 2571d61 commit 1150703

File tree

4 files changed

+28
-13
lines changed

4 files changed

+28
-13
lines changed

.github/workflows/nightly.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ jobs:
3939
- id: fetch-matrix
4040
run: echo "images=$(./images.rb)" >> "$GITHUB_OUTPUT"
4141

42+
- name: Download source
43+
run: curl -o ruby.tar.xz https://cache.ruby-lang.org/pub/ruby/snapshot/snapshot-master.tar.xz
44+
- uses: actions/upload-artifact@v4
45+
with:
46+
name: snapshot-master
47+
path: ruby.tar.xz
48+
retention-days: 1
49+
4250
build:
4351
needs: set-up-matrix
4452
runs-on: ubuntu-latest
@@ -74,6 +82,11 @@ jobs:
7482
username: ${{ github.repository_owner }}
7583
password: ${{ github.token }}
7684

85+
- uses: actions/download-artifact@v4
86+
with:
87+
name: snapshot-master
88+
path: ./master/${{ matrix.image.variant }}
89+
7790
- name: Build and push by digest
7891
id: build
7992
uses: docker/build-push-action@v6
@@ -165,6 +178,10 @@ jobs:
165178
166179
See more at https://github.com/docker-ruby-nightly/ruby/pkgs/container/ruby/versions?filters[version_type]=tagged
167180
EOT
181+
182+
- uses: actions/download-artifact@v4
183+
with:
184+
name: snapshot-master
168185

169186
- id: latest-release
170187
env:
@@ -176,4 +193,4 @@ jobs:
176193
if: (github.event_name == 'schedule' || inputs.push == true) && steps.latest-release.outputs.latest_release != needs.set-up-matrix.outputs.date
177194
env:
178195
GH_TOKEN: ${{ github.token }}
179-
run: gh release create ${{ needs.set-up-matrix.outputs.date }} --title="${{ needs.set-up-matrix.outputs.date }}" --notes-file=notes.txt
196+
run: gh release create ${{ needs.set-up-matrix.outputs.date }} ruby.tar.xz --title="${{ needs.set-up-matrix.outputs.date }}" --notes-file=notes.txt

.github/workflows/verify-templating.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Verify Templating
22

33
on:
44
pull_request:
5-
push:
5+
# push:
66

77
defaults:
88
run:

Dockerfile.template

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ ENV RUBY_DOWNLOAD_SHA256 {{ .sha256.xz }}
5858

5959
# some of ruby's build scripts are written in ruby
6060
# we purge system ruby later to make sure our final image uses what we just built
61-
RUN set -eux; \
61+
RUN --mount=type=bind,source=ruby.tar.xz,target=ruby.tar.xz \
62+
set -eux; \
6263
\
6364
{{ if is_alpine then ( -}}
6465
apk add --no-cache --virtual .ruby-builddeps \
@@ -197,12 +198,10 @@ RUN set -eux; \
197198
fi; \
198199
{{ ) else "" end -}}
199200
\
200-
wget -O ruby.tar.xz "$RUBY_DOWNLOAD_URL"; \
201201
echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum --check --strict; \
202202
\
203203
mkdir -p /usr/src/ruby; \
204204
tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1; \
205-
rm ruby.tar.xz; \
206205
\
207206
cd /usr/src/ruby; \
208207
\

nightly-versions.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@
1111
res = Net::HTTP.get_response(uri)
1212
raise StandardError, "Got status code #{res.code}: #{res.body}" unless res.code == "200"
1313

14-
master = JSON.parse(res.body).first
15-
master["url"] = master["filename"].transform_values { |file| "https://cache.ruby-lang.org/pub/ruby/snapshot/#{file}" }
16-
master.delete("filename")
17-
master.merge!({
14+
upstream = JSON.parse(res.body).first
15+
master = donor.slice("variants", "rust", "rustup")
16+
master.merge!(
1817
"version" => "master",
19-
"variants" => donor["variants"],
20-
"rust" => donor["rust"],
21-
"rustup" => donor["rustup"],
22-
})
18+
"date" => upstream["date"],
19+
"url" => { "xz" => "file://#{ENV["GITHUB_WORKSPACE"]}/ruby.tar.xz" },
20+
"sha256" => { "xz" => upstream["sha256"]["xz"] },
21+
)
2322
result = { "master" => master }.to_json
2423
# For step output
2524
puts result

0 commit comments

Comments
 (0)