diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml index 62892f99..2555c287 100644 --- a/.github/workflows/audit.yml +++ b/.github/workflows/audit.yml @@ -25,10 +25,54 @@ jobs: git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v3 + id: node with: node-version: 18.x - - name: Install npm@latest + check-latest: contains('18.x', '.x') + + # node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows + - name: Update Windows npm + if: | + matrix.platform.os == 'windows-latest' && ( + startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.') + ) + 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 + + # Start on Node 10 because we dont test on anything lower + - name: Install npm@7 on Node 10 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v10.') + id: npm-7 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@7 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@8 on Node 12 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v12.') + id: npm-8 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@8 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@9 on Node 14/16/18.0 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.') + id: npm-9 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@9 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@latest on Node + if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }} run: npm i --prefer-online --no-fund --no-audit -g npm@latest + - name: npm Version run: npm -v - name: Install Dependencies diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86f70f6c..ddce21dd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,10 +29,54 @@ jobs: git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v3 + id: node with: node-version: 18.x - - name: Install npm@latest + check-latest: contains('18.x', '.x') + + # node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows + - name: Update Windows npm + if: | + matrix.platform.os == 'windows-latest' && ( + startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.') + ) + 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 + + # Start on Node 10 because we dont test on anything lower + - name: Install npm@7 on Node 10 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v10.') + id: npm-7 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@7 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@8 on Node 12 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v12.') + id: npm-8 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@8 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@9 on Node 14/16/18.0 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.') + id: npm-9 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@9 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@latest on Node + if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }} run: npm i --prefer-online --no-fund --no-audit -g npm@latest + - name: npm Version run: npm -v - name: Install Dependencies @@ -67,11 +111,17 @@ jobs: git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v3 + id: node with: node-version: ${{ matrix.node-version }} + check-latest: contains(matrix.node-version, '.x') + + # node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows - 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.')) + if: | + matrix.platform.os == 'windows-latest' && ( + startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.') + ) run: | curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz tar xf npm-7.5.4.tgz @@ -79,12 +129,36 @@ jobs: 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.') - run: npm i --prefer-online --no-fund --no-audit -g npm@7 - - name: Install npm@latest - if: ${{ !startsWith(matrix.node-version, '10.') }} + + # Start on Node 10 because we dont test on anything lower + - name: Install npm@7 on Node 10 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v10.') + id: npm-7 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@7 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@8 on Node 12 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v12.') + id: npm-8 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@8 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@9 on Node 14/16/18.0 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.') + id: npm-9 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@9 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@latest on Node + if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }} run: npm i --prefer-online --no-fund --no-audit -g npm@latest + - name: npm Version run: npm -v - name: Install Dependencies diff --git a/.github/workflows/post-dependabot.yml b/.github/workflows/post-dependabot.yml index ce383405..c8898838 100644 --- a/.github/workflows/post-dependabot.yml +++ b/.github/workflows/post-dependabot.yml @@ -26,10 +26,54 @@ jobs: git config --global user.name "npm CLI robot" - name: Setup Node uses: actions/setup-node@v3 + id: node with: node-version: 18.x - - name: Install npm@latest + check-latest: contains('18.x', '.x') + + # node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows + - name: Update Windows npm + if: | + matrix.platform.os == 'windows-latest' && ( + startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.') + ) + 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 + + # Start on Node 10 because we dont test on anything lower + - name: Install npm@7 on Node 10 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v10.') + id: npm-7 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@7 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@8 on Node 12 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v12.') + id: npm-8 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@8 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@9 on Node 14/16/18.0 + shell: bash + if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.') + id: npm-9 + run: | + npm i --prefer-online --no-fund --no-audit -g npm@9 + echo "updated=true" >> "$GITHUB_OUTPUT" + + - name: Install npm@latest on Node + if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }} run: npm i --prefer-online --no-fund --no-audit -g npm@latest + - name: npm Version run: npm -v - name: Install Dependencies diff --git a/package.json b/package.json index 1bde8470..f9576b5b 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ }, "templateOSS": { "//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", - "version": "4.18.0", + "version": "4.18.1", "windowsCI": false, "macCI": false, "ciVersions": [