-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathget-supported-node-versions.yml
More file actions
35 lines (32 loc) · 1.3 KB
/
get-supported-node-versions.yml
File metadata and controls
35 lines (32 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
name: Get supported Node.js versions
on:
workflow_call:
outputs:
node-versions:
value: ${{ jobs.get-supported-node-versions.outputs.node-versions }}
default-version:
value: ${{ jobs.get-supported-node-versions.outputs.default-version }}
jobs:
get-supported-node-versions:
runs-on: ubuntu-latest
outputs:
node-versions: ${{ steps.get_versions.outputs.node-versions }}
default-version: ${{ steps.get_versions.outputs.default-version }}
steps:
- name: Get supported Node.js versions
id: get_versions
run: |
# Look for versions that are:
# - Currently supported
# - That are LTS
# - Within LTS date range (i.e. not future LTS)
NODE_VERSIONS=$(curl --silent https://raw.githubusercontent.com/nodejs/Release/main/schedule.json | jq --compact-output '
def today: now | strftime("%Y-%m-%d");
to_entries
| map(select(.value.end > today and .value.lts != null and .value.lts < today))
| [.[0].key, .[-1].key]
| unique
')
echo "node-versions=${NODE_VERSIONS}" >> ${GITHUB_OUTPUT}
# Default to using the newest version
echo "default-version=$(jq -r '.[1]' <<< ${NODE_VERSIONS})" >> ${GITHUB_OUTPUT}