Skip to content

Commit 0d4d59e

Browse files
committed
chore: @npmcli/template-oss@4.21.1
1 parent 95ec044 commit 0d4d59e

23 files changed

+924
-2786
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: 'Create Check'
4+
inputs:
5+
name:
6+
required: true
7+
token:
8+
required: true
9+
sha:
10+
required: true
11+
check-name:
12+
default: ''
13+
outputs:
14+
check-id:
15+
value: ${{ steps.create-check.outputs.check_id }}
16+
runs:
17+
using: "composite"
18+
steps:
19+
- name: Get Workflow Job
20+
uses: actions/github-script@v6
21+
id: workflow
22+
env:
23+
JOB_NAME: "${{ inputs.name }}"
24+
SHA: "${{ inputs.sha }}"
25+
with:
26+
result-encoding: string
27+
script: |
28+
const { repo: { owner, repo}, runId, serverUrl } = context
29+
const { JOB_NAME, SHA } = process.env
30+
31+
const job = await github.rest.actions.listJobsForWorkflowRun({
32+
owner,
33+
repo,
34+
run_id: runId,
35+
per_page: 100
36+
}).then(r => r.data.jobs.find(j => j.name.endsWith(JOB_NAME)))
37+
38+
return [
39+
`This check is assosciated with ${serverUrl}/${owner}/${repo}/commit/${SHA}.`,
40+
'Run logs:',
41+
job?.html_url || `could not be found for a job ending with: "${JOB_NAME}"`,
42+
].join(' ')
43+
- name: Create Check
44+
uses: LouisBrunner/checks-action@v1.6.0
45+
id: create-check
46+
with:
47+
token: ${{ inputs.token }}
48+
sha: ${{ inputs.sha }}
49+
status: in_progress
50+
name: ${{ inputs.check-name || inputs.name }}
51+
output: |
52+
{"summary":"${{ steps.workflow.outputs.result }}"}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This file is automatically added by @npmcli/template-oss. Do not edit.
2+
3+
name: 'Install Latest npm'
4+
description: 'Install the latest version of npm compatible with the Node version'
5+
inputs:
6+
node:
7+
description: 'Current Node version'
8+
required: true
9+
runs:
10+
using: "composite"
11+
steps:
12+
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
13+
- name: Update Windows npm
14+
if: |
15+
runner.os == 'Windows' && (
16+
startsWith(inputs.node, 'v10.') ||
17+
startsWith(inputs.node, 'v12.') ||
18+
startsWith(inputs.node, 'v14.')
19+
)
20+
shell: cmd
21+
run: |
22+
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
23+
tar xf npm-7.5.4.tgz
24+
cd package
25+
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
26+
cd ..
27+
rmdir /s /q package
28+
- name: Install Latest npm
29+
shell: bash
30+
env:
31+
NODE_VERSION: ${{ inputs.node }}
32+
working-directory: ${{ runner.temp }}
33+
run: |
34+
MATCH=""
35+
SPECS=("latest" "next-10" "next-9" "next-8" "next-7" "next-6")
36+
37+
echo "node@$NODE_VERSION"
38+
39+
for SPEC in ${SPECS[@]}; do
40+
ENGINES=$(npm view npm@$SPEC --json | jq -r '.engines.node')
41+
echo "Checking if node@$NODE_VERSION satisfies npm@$SPEC ($ENGINES)"
42+
43+
if npx semver -r "$ENGINES" "$NODE_VERSION" > /dev/null; then
44+
MATCH=$SPEC
45+
echo "Found compatible version: npm@$MATCH"
46+
break
47+
fi
48+
done
49+
50+
if [ -z $MATCH ]; then
51+
echo "Could not find a compatible version of npm for node@$NODE_VERSION"
52+
exit 1
53+
fi
54+
55+
npm i --prefer-online --no-fund --no-audit -g npm@$MATCH
56+
- name: npm Version
57+
shell: bash
58+
run: npm -v

.github/workflows/audit.yml

Lines changed: 4 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -30,52 +30,10 @@ jobs:
3030
node-version: 18.x
3131
check-latest: contains('18.x', '.x')
3232
cache: npm
33-
34-
# node 10/12/14 ship with npm@6, which is known to fail when updating itself in windows
35-
- name: Update Windows npm
36-
if: |
37-
matrix.platform.os == 'windows-latest' && (
38-
startsWith(steps.node.outputs.node-version, 'v10.') || startsWith(steps.node.outputs.node-version, 'v12.') || startsWith(steps.node.outputs.node-version, 'v14.')
39-
)
40-
run: |
41-
curl -sO https://registry.npmjs.org/npm/-/npm-7.5.4.tgz
42-
tar xf npm-7.5.4.tgz
43-
cd package
44-
node lib/npm.js install --no-fund --no-audit -g ..\npm-7.5.4.tgz
45-
cd ..
46-
rmdir /s /q package
47-
48-
# Start on Node 10 because we dont test on anything lower
49-
- name: Install npm@7 on Node 10
50-
shell: bash
51-
if: startsWith(steps.node.outputs.node-version, 'v10.')
52-
id: npm-7
53-
run: |
54-
npm i --prefer-online --no-fund --no-audit -g npm@7
55-
echo "updated=true" >> "$GITHUB_OUTPUT"
56-
57-
- name: Install npm@8 on Node 12
58-
shell: bash
59-
if: startsWith(steps.node.outputs.node-version, 'v12.')
60-
id: npm-8
61-
run: |
62-
npm i --prefer-online --no-fund --no-audit -g npm@8
63-
echo "updated=true" >> "$GITHUB_OUTPUT"
64-
65-
- name: Install npm@9 on Node 14/16/18.0
66-
shell: bash
67-
if: startsWith(steps.node.outputs.node-version, 'v14.') || startsWith(steps.node.outputs.node-version, 'v16.') || startsWith(steps.node.outputs.node-version, 'v18.0.')
68-
id: npm-9
69-
run: |
70-
npm i --prefer-online --no-fund --no-audit -g npm@9
71-
echo "updated=true" >> "$GITHUB_OUTPUT"
72-
73-
- name: Install npm@latest on Node
74-
if: ${{ !(steps.npm-7.outputs.updated || steps.npm-8.outputs.updated || steps.npm-9.outputs.updated) }}
75-
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
76-
77-
- name: npm Version
78-
run: npm -v
33+
- name: Install Latest npm
34+
uses: ./.github/actions/install-latest-npm
35+
with:
36+
node: ${{ steps.node.outputs.node-version }}
7937
- name: Install Dependencies
8038
run: npm i --no-audit --no-fund --package-lock
8139
- name: Run Production Audit

.github/workflows/ci-cli.yml

Lines changed: 8 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)