33
33
steps :
34
34
- uses : actions/checkout@v4
35
35
36
- - id : setup-node
37
- name : Use Node.js ${{ matrix.node-version }}
36
+ - name : Use Node.js ${{ matrix.node-version }}
38
37
uses : actions/setup-node@v4
39
38
with :
40
39
node-version : ${{ matrix.node-version }}
48
47
uses : apexskier/github-semver-parse@v1
49
48
with :
50
49
version : ${{ steps.node-v.outputs.version }}
51
-
52
- - run : which jq
53
-
54
- - env :
55
- N_MAJOR : ${{steps.node-version.outputs.major}}
56
- N_MINOR : ${{steps.node-version.outputs.minor}}
57
- run : echo "node - $N_MAJOR $N_MINOR"
58
50
59
51
- id : npm-v
60
52
name : Output npm version
@@ -65,33 +57,23 @@ jobs:
65
57
uses : apexskier/github-semver-parse@v1
66
58
with :
67
59
version : ${{ steps.npm-v.outputs.version }}
68
-
69
- - env :
70
- N_MAJOR : ${{steps.npm-version.outputs.major}}
71
- N_MINOR : ${{steps.npm-version.outputs.minor}}
72
- run : echo "npm - $N_MAJOR $N_MINOR"
73
60
74
61
- id : lockfile-version
75
- name : Get package lockfileVersion
62
+ name : Check package lockfileVersion
76
63
run : echo "version=$(cat package-lock.json | jq '.lockfileVersion')" >> $GITHUB_OUTPUT
77
64
if : hashFiles('package-lock.json') != ''
78
-
79
- - env :
80
- N_MAJOR : ${{steps.lockfile-version.outputs.version}}
81
- run : echo "lockfile - $N_MAJOR"
82
65
83
66
- id : clean-install-v3
84
- name : Clean install with lockfileVersion >= 3
67
+ name : Clean install
85
68
run : npm ci
86
69
if : steps.npm-version.outputs.major >= 7 && steps.lockfile-version.outputs.version >= 3
87
70
88
71
- id : clean-install-v3-compat
89
- name : Install with lockfileVersion >= 3
72
+ name : ' Install with lockfileVersion: 3 for compatibility with npm v6 '
90
73
run : npm install
91
74
if : steps.npm-version.outputs.major < 7 && steps.npm-version.outputs.major >= 5 && steps.lockfile-version.outputs.version >= 3
92
75
93
- - id : clean-install
94
- name : Clean install
76
+ - name : Clean install
95
77
run : npm ci
96
78
# The [`ci`][1] command was [introduced][2] with npm@5, and is intended to
97
79
# be used in continuous integration environments. If npm@5 or later is
104
86
if : steps.npm-version.outputs.major >= 5 && steps.lockfile-version.outputs.version != null
105
87
&& steps.clean-install-v3.outcome == 'skipped' && steps.clean-install-v3-compat.outcome == 'skipped'
106
88
107
- - run : npm install
108
- name : Install
89
+ - name : Install
90
+ run : npm install
109
91
if : steps.npm-version.outputs.major < 5 || steps.lockfile-version.outputs.version == null
110
92
111
93
- run : npm test
0 commit comments