ci: Select Node.js versions dynamically

This commit is contained in:
Mykola Mokhnach
2023-08-03 09:42:43 +02:00
committed by GitHub
parent 95a34185d1
commit 6c4189b400
+10 -1
View File
@@ -42,11 +42,20 @@ permissions:
contents: read
jobs:
prepare_matrix:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.generate-matrix.outputs.versions }}
steps:
- name: Select 3 most recent LTS versions of Node.js
id: generate-matrix
run: echo "versions=$(curl -s https://endoflife.date/api/nodejs.json | jq -c '[[.[] | select(.lts != false)][:3] | .[].cycle | tonumber]')" >> "$GITHUB_OUTPUT"
test:
name: Tests
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: ${{ fromJSON(needs.prepare_matrix.outputs.versions) }}
os:
- ubuntu-latest
# TODO: Windows is not stable and slow to run