Skip to content

Commit

Permalink
Modify release ruby_versions
Browse files Browse the repository at this point in the history
  • Loading branch information
uvlad7 committed Oct 29, 2023
1 parent e8143a5 commit 298da4c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ jobs:
with:
supported-ruby-platforms: |
exclude: []
stable-ruby-versions: |
exclude: [head]
# stable-ruby-versions: |
# exclude: [head]
cross-gem:
name: Compile native gem for ${{ matrix.platform }}
runs-on: ubuntu-latest
Expand All @@ -45,13 +45,26 @@ jobs:
bundler-cache: true
rubygems: "3.4.14"

- name: Fetch supported Ruby versions
id: ruby_version
shell: bash
run: |
: Run query
result="$(ruby $GITHUB_ACTION_PATH/ruby_versions.rb $GITHUB_WORKSPACE/xml2json.gemspec)"
echo "ruby_versions=$result" >> $GITHUB_OUTPUT
- name: Cross-compile gem
uses: oxidize-rb/actions/cross-gem@v1
id: cross-gem
with:
platform: ${{ matrix.platform }}
# ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.result).stable-ruby-versions, ',') }}
ruby-versions: 2.6,2.7,3.0,3.1,3.2
ruby-versions: ${{ steps.ruby_version.outputs.ruby_versions }}

- name: Test cross-compiled gem
uses: oxidize-rb/actions/test-gem-build@main
with:
platform: ${{ matrix.ruby-platform }}
ruby-versions: ${{ steps.ruby_version.outputs.ruby_versions }}

- name: Upload artifact
uses: actions/upload-artifact@v3
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/ruby_versions.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

require "net/http"
require "json"

RUBY_VERSIONS_URL = "https://endoflife.date/api/ruby.json"

gemspec = Gem::Specification.load(ARGV[0])

puts(JSON.parse(Net::HTTP.get(URI(RUBY_VERSIONS_URL))).map do |ver|
ver["cycle"] if gemspec.required_ruby_version.satisfied_by?(Gem::Version.new(ver["cycle"]))
end.compact.join(","))

0 comments on commit 298da4c

Please sign in to comment.