@@ -38,52 +38,10 @@ jobs:
3838 node-version : 18.x
3939 check-latest : contains('18.x', '.x')
4040 cache : npm
41-
42- # node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
43- - name : Update Windows npm
44- if : |
45- matrix.platform.os == 'windows-latest' && (
46- startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
47- )
48- run : |
49- curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
50- tar xf npm-7.5.4.tgz
51- cd package
52- node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
53- cd ..
54- rmdir /s /q package
55-
56- # Start on Node 10 because we dont test on anything lower
57- - name : Install npm@7 on Node 10
58- shell : bash
59- if : startsWith(steps.node.outputs.node-version, 'v10.')
60- id : npm-7
61- run : |
62- npm i --prefer-online --no-fund --no-audit -g npm@7
63- echo "updated=true" >> "$GITHUB_OUTPUT"
64-
65- - name : Install npm@8 on Node 12
66- shell : bash
67- if : startsWith(steps.node.outputs.node-version, 'v12.')
68- id : npm-8
69- run : |
70- npm i --prefer-online --no-fund --no-audit -g npm@8
71- echo "updated=true" >> "$GITHUB_OUTPUT"
72-
73- - name : Install npm@9 on Node 14/16/18.0
74- shell : bash
75- if : startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
76- id : npm-9
77- run : |
78- npm i --prefer-online --no-fund --no-audit -g npm@9
79- echo "updated=true" >> "$GITHUB_OUTPUT"
80-
81- - name : Install npm@latest on Node
82- if : ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
83- run : npm i --prefer-online --no-fund --no-audit -g npm@latest
84-
85- - name : npm Version
86- run : npm -v
41+ - name : Install Latest npm
42+ uses : ./.github/actions/install-latest-npm
43+ with :
44+ node : ${{ steps.node.outputs.node-version }}
8745 - name : Install Dependencies
8846 run : npm i --no-audit --no-fund
8947 - name : Lint
@@ -123,52 +81,10 @@ jobs:
12381 node-version : ${{ matrix.node-version }}
12482 check-latest : contains(matrix.node-version, '.x')
12583 cache : npm
126-
127- # node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
128- - name : Update Windows npm
129- if : |
130- matrix.platform.os == 'windows-latest' && (
131- startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
132- )
133- run : |
134- curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
135- tar xf npm-7.5.4.tgz
136- cd package
137- node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
138- cd ..
139- rmdir /s /q package
140-
141- # Start on Node 10 because we dont test on anything lower
142- - name : Install npm@7 on Node 10
143- shell : bash
144- if : startsWith(steps.node.outputs.node-version, 'v10.')
145- id : npm-7
146- run : |
147- npm i --prefer-online --no-fund --no-audit -g npm@7
148- echo "updated=true" >> "$GITHUB_OUTPUT"
149-
150- - name : Install npm@8 on Node 12
151- shell : bash
152- if : startsWith(steps.node.outputs.node-version, 'v12.')
153- id : npm-8
154- run : |
155- npm i --prefer-online --no-fund --no-audit -g npm@8
156- echo "updated=true" >> "$GITHUB_OUTPUT"
157-
158- - name : Install npm@9 on Node 14/16/18.0
159- shell : bash
160- if : startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
161- id : npm-9
162- run : |
163- npm i --prefer-online --no-fund --no-audit -g npm@9
164- echo "updated=true" >> "$GITHUB_OUTPUT"
165-
166- - name : Install npm@latest on Node
167- if : ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
168- run : npm i --prefer-online --no-fund --no-audit -g npm@latest
169-
170- - name : npm Version
171- run : npm -v
84+ - name : Install Latest npm
85+ uses : ./.github/actions/install-latest-npm
86+ with :
87+ node : ${{ steps.node.outputs.node-version }}
17288 - name : Install Dependencies
17389 run : npm i --no-audit --no-fund
17490 - name : Add Problem Matcher
0 commit comments