-
Notifications
You must be signed in to change notification settings - Fork 786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Auto update Ruby definition with Ruby releases #2430
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Update Ruby definitions | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
ruby_version: | ||
description: 'Ruby version' | ||
required: true | ||
default: '3.3.4' | ||
openssl_version: | ||
description: 'OpenSSL version' | ||
required: true | ||
default: '3.0.14' | ||
|
||
repository_dispatch: | ||
types: [update-ruby] | ||
|
||
jobs: | ||
update-ruby: | ||
name: Update Ruby definitions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Store Ruby version | ||
run: echo "RUBY_VERSION=${{ github.event.client_payload.ruby_version || github.event.inputs.ruby_version }}" >> $GITHUB_ENV | ||
|
||
- name: Store ABI version | ||
run: echo "ABI_VERSION=$(echo ${{ env.RUBY_VERSION }} | cut -d '.' -f 1-2)" >> $GITHUB_ENV | ||
|
||
- name: Store OpenSSL version | ||
run: echo "OPENSSL_VERSION=${{ github.event.client_payload.openssl_version || github.event.inputs.openssl_version }}" >> $GITHUB_ENV | ||
|
||
- name: Run script/update-cruby | ||
run: | | ||
curl -sL https://cache.ruby-lang.org/pub/ruby/${{ env.ABI_VERSION }}/ruby-${{ env.RUBY_VERSION }}.tar.gz | ||
curl -sL https://www.openssl.org/source/openssl-${{ env.OPENSSL_VERSION }}.tar.gz | ||
script/update-cruby ${{ env.RUBY_VERSION }} ${{ env.OPENSSL_VERSION }} . | ||
|
||
- name: commit and push | ||
run: | | ||
git config user.name "GitHub Actions Bot" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
git add . | ||
git commit -m "Added ${{ env.RUBY_VERSION }} with OpenSSL ${{ env.OPENSSL_VERSION }}" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.COMMITTER_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,16 +3,18 @@ | |
set -e | ||
set -o pipefail | ||
|
||
if [ $# -ne 2 ]; then | ||
echo "usage: $0 VERSION RELEASE_DIRECTORY" | ||
if [ $# -ne 3 ]; then | ||
echo "usage: $0 VERSION OPENSSL_VERSION RELEASE_DIRECTORY" | ||
exit 1 | ||
fi | ||
|
||
version="$1" | ||
release_directory="$2" | ||
openssl_version="$2" | ||
release_directory="$3" | ||
file="share/ruby-build/${version}" | ||
|
||
basename="ruby-${version}.tar.gz" | ||
openssl_basename="openssl-${openssl_version}.tar.gz" | ||
major_minor_version=$(echo ${version} | cut -d '.' -f 1,2) | ||
url="https://cache.ruby-lang.org/pub/ruby/${major_minor_version}/${basename}" | ||
if command -v sha256sum >/dev/null; then | ||
|
@@ -24,7 +26,17 @@ else | |
exit 1 | ||
fi | ||
|
||
openssl_url="https://www.openssl.org/source/openssl-${openssl_version}.tar.gz" | ||
if command -v sha256sum >/dev/null; then | ||
openssl_sha256=$(sha256sum "$release_directory/$openssl_basename" | cut -d ' ' -f 1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you need to download the openssl archive before this line, otherwise it won't be there There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah it's done in the workflow, I see. That doesn't seem practical if this script is ever run manually though. |
||
elif command -v shasum >/dev/null; then | ||
openssl_sha256=$(shasum -a 256 "$release_directory/$openssl_basename" | cut -d ' ' -f 1) | ||
else | ||
echo "$0 requires sha256sum or shasum to be installed on the system." | ||
exit 1 | ||
fi | ||
|
||
cat > "$file" <<EOS | ||
!TODO! copy openssl line from other release with the same major.minor version | ||
install_package "openssl-${openssl_version}" "${openssl_url}#${openssl_sha256}" openssl --if needs_openssl:1.0.2-3.x.x | ||
install_package "ruby-${version}" "${url}#${sha256}" enable_shared standard | ||
EOS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these lines supposed to do or verify something? If we wanted to download these URLs to local files, I do not think curl will do it unless
-O
was used?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I added
-O
at e12c32f