Skip to content

Commit b0d505a

Browse files
committed
Getting Ruby and Rails versions from endoflife.date
1 parent ade0fb3 commit b0d505a

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
11
name: CI
22
on:
33
push:
4-
branches: [main]
4+
# branches: [main]
55
pull_request:
66
jobs:
7+
versions:
8+
name: Get latest versions
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
product: ["ruby", "rails"]
13+
outputs:
14+
ruby: ${{ steps.supported.outputs.ruby }}
15+
rails: ${{ steps.supported.outputs.rails }}
16+
steps:
17+
- id: supported
18+
run: |
19+
product="${{ matrix.product }}"
20+
data=$(curl https://endoflife.date/api/$product.json)
21+
supported=$(echo $data | jq '[.[] | select(.eol > (now | strftime("%Y-%m-%d")))]')
22+
echo "${product}=$(echo $supported | jq -c 'map(.latest)')" >> $GITHUB_OUTPUT
723
test:
8-
name: Test on Ruby ${{ matrix.ruby }} and Rails ${{ matrix.rails }}
24+
needs: versions
925
runs-on: ubuntu-latest
26+
name: Test on Ruby ${{ matrix.ruby }} and Rails ${{ matrix.rails }}
1027
strategy:
1128
fail-fast: false
1229
matrix:
13-
ruby: ['3.0', '3.1', '3.2', '3.3']
14-
rails: ['6.1.0', '7.0.0', '7.1.0']
30+
ruby: ${{ fromJSON(needs.versions.outputs.ruby) }}
31+
rails: ${{ fromJSON(needs.versions.outputs.rails) }}
1532
env:
1633
RAILS_VERSION: ${{ matrix.rails }}
1734
steps:

0 commit comments

Comments
 (0)