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
|
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: {{#if jobIsMatrix}}$\{{ matrix.node-version }}{{else}}{{ last ciVersions }}{{/if}}
{{#if lockfile}}
cache: npm
{{/if}}
{{#if updateNpm}}
{{#if jobIsMatrix}}
- name: Update Windows npm
# node 12 and 14 ship with npm@6, which is known to fail when updating itself in windows
if: matrix.platform.os == 'windows-latest' && (startsWith(matrix.node-version, '12.') || startsWith(matrix.node-version, '14.'))
run: |
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
tar xf npm-7.5.4.tgz
cd package
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
cd ..
rmdir /s /q package
- name: Install npm@7
if: startsWith(matrix.node-version, '10.') || startsWith(matrix.node-version, '12.')
run: npm i --prefer-online --no-fund --no-audit -g npm@7
- name: Install npm@latest
if: $\{{ !startsWith(matrix.node-version, '10.') && !startsWith(matrix.node-version, '12.') }}
{{else}}
- name: Install npm@latest
{{/if}}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- name: npm Version
run: npm -v
{{/if}}
|