Skip to content

Commit

Permalink
Set Rails versions automatically
Browse files Browse the repository at this point in the history
We call the Rubygems API and get the latest version for
5,6 and 7, then set those to the matrix values.
  • Loading branch information
pezholio committed May 17, 2024
1 parent 1aa836b commit e6176ae
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions .github/workflows/rails-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@ on:
branches:
- main

env:
RAILS_VERSIONS: '["5.2.8.1", "6.1.7.6", "7.1.3.2"]'

jobs:
set-matrix:
runs-on: ubuntu-latest
name: Set Rails versions
outputs:
RAILS_VERSIONS: ${{ env.RAILS_VERSIONS }}
RAILS_VERSIONS: ${{ steps.set-matrix.outputs.RAILS_VERSIONS }}
steps:
- name: Compute outputs
run: |
echo "RAILS_VERSIONS=${{ env.RAILS_VERSIONS }}" >> $GITHUB_OUTPUT
rails_versions=$(curl https://rubygems.org/api/v1/versions/rails.json | jq 'group_by(.number[:1])[] | (.[0].number) | select(.[:1]|tonumber > 4)' | jq -s -c)
echo "RAILS_VERSIONS=$rails_versions" >> $GITHUB_OUTPUT
build-rails:
strategy:
fail-fast: false
Expand Down

0 comments on commit e6176ae

Please sign in to comment.