Skip to content

Commit 548f6a5

Browse files
committed
Make node version dynamic
1 parent b55e48f commit 548f6a5

6 files changed

Lines changed: 57 additions & 6 deletions

File tree

.github/workflows/code_quality.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ on:
88
pull_request:
99

1010
jobs:
11+
node-versions:
12+
uses: ./.github/workflows/get-supported-node-versions.yml
13+
1114
check-code-quality:
1215
name: Check code quality
1316
runs-on: ubuntu-latest
17+
needs: node-versions
1418

1519
steps:
1620
- name: Setup Node.js
1721
uses: actions/setup-node@v4
1822
with:
19-
node-version: 12
23+
node-version: ${{ needs.node-versions.outputs.default-version }}
2024
- name: Checkout code
2125
uses: actions/checkout@v4
2226
- name: Install dependencies

.github/workflows/code_sample_checker.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@ name: Code sample checker
22
on: pull_request
33

44
jobs:
5+
node-versions:
6+
uses: ./.github/workflows/get-supported-node-versions.yml
7+
58
test-code-samples:
69
name: Check code samples
710
runs-on: ${{matrix.os}}
11+
needs: node-versions
812

913
strategy:
1014
matrix:
@@ -23,7 +27,7 @@ jobs:
2327
- name: Setup Node.js
2428
uses: actions/setup-node@v4
2529
with:
26-
node-version: 10
30+
node-version: ${{ needs.node-versions.outputs.default-version }}
2731
- name: Install dependencies and compile client
2832
run: |
2933
npm install

.github/workflows/coverage_runner.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,14 @@ jobs:
2828
member-name: ${{ github.actor }}
2929
token: ${{ secrets.PAT }}
3030

31+
node-versions:
32+
uses: ./.github/workflows/get-supported-node-versions.yml
33+
3134
run-tests:
3235
name: Run Tests on (${{ matrix.os }})
33-
needs: [check_for_membership]
36+
needs:
37+
- check_for_membership
38+
- node-versions
3439
if: github.event_name == 'push' || needs.check_for_membership.outputs.check-result == 'true' || github.event_name == 'workflow_dispatch'
3540
runs-on: ${{ matrix.os }}
3641
strategy:
@@ -64,7 +69,7 @@ jobs:
6469
- name: Setup Node.js
6570
uses: actions/setup-node@v4
6671
with:
67-
node-version: 10
72+
node-version: ${{ needs.node-versions.outputs.default-version }}
6873

6974
- name: Checkout to test artifacts
7075
uses: actions/checkout@v4
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Get supported Node.js versions
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
node-versions:
7+
value: ${{ jobs.get-supported-node-versions.outputs.node-versions }}
8+
default-version:
9+
value: ${{ jobs.get-supported-node-versions.outputs.default-version }}
10+
11+
jobs:
12+
get-supported-node-versions:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
node-versions: ${{ steps.get_versions.outputs.node-versions }}
16+
default-version: ${{ steps.get_versions.outputs.default-version }}
17+
steps:
18+
- name: Get supported Node.js versions
19+
id: get_versions
20+
run: |
21+
NODE_VERSIONS = $(curl --silent https://raw.githubusercontent.com/nodejs/Release/main/schedule.json | jq --compact-output '
22+
def today: now | strftime("%Y-%m-%d");
23+
to_entries
24+
| map(select(.value.end > today))
25+
| [.[0].key, .[-1].key]
26+
')
27+
28+
echo "node-versions=${NODE_VERSIONS}" >> ${GITHUB_OUTPUT}
29+
# Default to using the newest version
30+
echo "default-version=$(jq -r '.[1]' <<< ${NODE_VERSIONS})" >> ${GITHUB_OUTPUT}

.github/workflows/nightly_runner_maintenance.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ on:
44
schedule:
55
- cron: '0 2 */2 * *'
66
jobs:
7+
node-versions:
8+
uses: ./.github/workflows/get-supported-node-versions.yml
9+
710
run-tests:
811
runs-on: ${{ matrix.os }}
12+
needs: node-versions
913
name: Run tests of branch ${{ matrix.branch }} on ${{ matrix.os }} with Node ${{ matrix.nodejs_version }}
1014
strategy:
1115
matrix:
1216
branch: [ 5.0.x, 4.2.x, 4.1.x, 4.0.x ]
1317
os: [ ubuntu-latest, windows-latest ]
14-
nodejs_version: [ 10, 18 ]
18+
nodejs_version: ${{ fromJSON(needs.node-versions.outputs.node-versions) }}
1519
fail-fast: false
1620
steps:
1721
- name: Setup Java

.github/workflows/nightly_runner_master.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,17 @@ on:
44
schedule:
55
- cron: '0 2 * * *'
66
jobs:
7+
node-versions:
8+
uses: ./.github/workflows/get-supported-node-versions.yml
9+
710
run-tests:
811
runs-on: ${{ matrix.os }}
12+
needs: node-versions
913
name: Run tests of master on ${{ matrix.os }} with Node ${{ matrix.nodejs_version }}
1014
strategy:
1115
matrix:
1216
os: [ ubuntu-latest, windows-latest ]
13-
nodejs_version: [ 10, 18 ]
17+
nodejs_version: ${{ fromJSON(needs.node-versions.outputs.node-versions) }}
1418
fail-fast: false
1519
steps:
1620
- name: Checkout code

0 commit comments

Comments
 (0)