From 391a4e453341ad5fb3a4cc421fa53c4eafbc1819 Mon Sep 17 00:00:00 2001 From: pezholio Date: Tue, 19 Nov 2024 13:32:25 +0000 Subject: [PATCH] Set Ruby version for Dockerfile from .ruby-version --- .github/workflows/rails-integration-tests.yml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rails-integration-tests.yml b/.github/workflows/rails-integration-tests.yml index afe54a5..18fbe99 100644 --- a/.github/workflows/rails-integration-tests.yml +++ b/.github/workflows/rails-integration-tests.yml @@ -20,6 +20,18 @@ jobs: run: | rails_versions=$(curl https://rubygems.org/api/v1/versions/rails.json | jq '[.[] | select(.number | test("beta") | not)] | group_by(.number[:1])[] | (.[0].number) | select(.[:1]|tonumber > 5)' | jq -s -c) echo "RAILS_VERSIONS=$rails_versions" >> $GITHUB_OUTPUT + set-ruby-version: + runs-on: ubuntu-latest + name: Set Ruby version + outputs: + RAILS_VERSIONS: ${{ steps.set-ruby-version.outputs.RUBY_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - id: set-ruby-version + name: Set Ruby version + run: | + echo "RUBY_VERSION=$(cat .ruby-version)" >> $GITHUB_OUTPUT build-rails: strategy: fail-fast: false @@ -28,7 +40,9 @@ jobs: rails: ${{ fromJSON(needs.set-matrix.outputs.RAILS_VERSIONS) }} runs-on: ubuntu-latest name: Build and cache Docker containers - needs: set-matrix + needs: + - set-matrix + - set-ruby-version steps: - name: Checkout uses: actions/checkout@v4 @@ -42,6 +56,7 @@ jobs: build-args: | RAILS_VERSION=${{ matrix.rails }} MAIL_NOTIFY_BRANCH=${{ github.ref }} + RUBY_VERSION=${{ needs.set-ruby-version.outputs.RUBY_VERSION }} push: false tags: mail-notify-integration-rails-${{ matrix.rails }}:latest outputs: type=docker, dest=/tmp/rails-${{ matrix.rails }}-image.tar @@ -61,6 +76,7 @@ jobs: runs-on: ubuntu-latest needs: - set-matrix + - set-ruby-version - build-rails steps: - name: Download image @@ -85,6 +101,7 @@ jobs: runs-on: ubuntu-latest needs: - set-matrix + - set-ruby-version - build-rails steps: - name: Download image