Skip to content

Commit

Permalink
Attach source during build to the release
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Nov 15, 2024
1 parent 2571d61 commit 1150703
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ jobs:
- id: fetch-matrix
run: echo "images=$(./images.rb)" >> "$GITHUB_OUTPUT"

- name: Download source
run: curl -o ruby.tar.xz https://cache.ruby-lang.org/pub/ruby/snapshot/snapshot-master.tar.xz
- uses: actions/upload-artifact@v4
with:
name: snapshot-master
path: ruby.tar.xz
retention-days: 1

build:
needs: set-up-matrix
runs-on: ubuntu-latest
Expand Down Expand Up @@ -74,6 +82,11 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- uses: actions/download-artifact@v4
with:
name: snapshot-master
path: ./master/${{ matrix.image.variant }}

- name: Build and push by digest
id: build
uses: docker/build-push-action@v6
Expand Down Expand Up @@ -165,6 +178,10 @@ jobs:
See more at https://github.com/docker-ruby-nightly/ruby/pkgs/container/ruby/versions?filters[version_type]=tagged
EOT
- uses: actions/download-artifact@v4
with:
name: snapshot-master

- id: latest-release
env:
Expand All @@ -176,4 +193,4 @@ jobs:
if: (github.event_name == 'schedule' || inputs.push == true) && steps.latest-release.outputs.latest_release != needs.set-up-matrix.outputs.date
env:
GH_TOKEN: ${{ github.token }}
run: gh release create ${{ needs.set-up-matrix.outputs.date }} --title="${{ needs.set-up-matrix.outputs.date }}" --notes-file=notes.txt
run: gh release create ${{ needs.set-up-matrix.outputs.date }} ruby.tar.xz --title="${{ needs.set-up-matrix.outputs.date }}" --notes-file=notes.txt
2 changes: 1 addition & 1 deletion .github/workflows/verify-templating.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Verify Templating

on:
pull_request:
push:
# push:

defaults:
run:
Expand Down
5 changes: 2 additions & 3 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ ENV RUBY_DOWNLOAD_SHA256 {{ .sha256.xz }}

# some of ruby's build scripts are written in ruby
# we purge system ruby later to make sure our final image uses what we just built
RUN set -eux; \
RUN --mount=type=bind,source=ruby.tar.xz,target=ruby.tar.xz \
set -eux; \
\
{{ if is_alpine then ( -}}
apk add --no-cache --virtual .ruby-builddeps \
Expand Down Expand Up @@ -197,12 +198,10 @@ RUN set -eux; \
fi; \
{{ ) else "" end -}}
\
wget -O ruby.tar.xz "$RUBY_DOWNLOAD_URL"; \
echo "$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz" | sha256sum --check --strict; \
\
mkdir -p /usr/src/ruby; \
tar -xJf ruby.tar.xz -C /usr/src/ruby --strip-components=1; \
rm ruby.tar.xz; \
\
cd /usr/src/ruby; \
\
Expand Down
15 changes: 7 additions & 8 deletions nightly-versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,14 @@
res = Net::HTTP.get_response(uri)
raise StandardError, "Got status code #{res.code}: #{res.body}" unless res.code == "200"

master = JSON.parse(res.body).first
master["url"] = master["filename"].transform_values { |file| "https://cache.ruby-lang.org/pub/ruby/snapshot/#{file}" }
master.delete("filename")
master.merge!({
upstream = JSON.parse(res.body).first
master = donor.slice("variants", "rust", "rustup")
master.merge!(
"version" => "master",
"variants" => donor["variants"],
"rust" => donor["rust"],
"rustup" => donor["rustup"],
})
"date" => upstream["date"],
"url" => { "xz" => "file://#{ENV["GITHUB_WORKSPACE"]}/ruby.tar.xz" },
"sha256" => { "xz" => upstream["sha256"]["xz"] },
)
result = { "master" => master }.to_json
# For step output
puts result
Expand Down

0 comments on commit 1150703

Please sign in to comment.