From 5b5f3df9a5f3d0a24fc876e61aa41cf868b7f8f7 Mon Sep 17 00:00:00 2001 From: pezholio Date: Fri, 17 May 2024 16:58:52 +0100 Subject: [PATCH] Set Rails versions automatically We call the Rubygems API and get the latest version for 5,6 and 7, then set those to the matrix values. --- .github/workflows/rails-integration-tests.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/rails-integration-tests.yml b/.github/workflows/rails-integration-tests.yml index 5170771..d2d2385 100644 --- a/.github/workflows/rails-integration-tests.yml +++ b/.github/workflows/rails-integration-tests.yml @@ -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