Skip to content

Commit 1c6046e

Browse files
committed
ci: run next.js deps with netlify-cli dev dep
1 parent 3842695 commit 1c6046e

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

.github/workflows/test-e2e.yml

+3-4
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,9 @@ jobs:
180180
run: npm run build
181181
working-directory: ${{ env.runtime-path }}
182182

183-
# TODO(serhalp) Use the netlify-cli dev dep? It's a bit trickier here because we're running in
184-
# the next.js directory, not the next-runtime directory. See https://github.com/netlify/next-runtime/pull/2484.
185-
- name: add netlify cli
186-
run: npm install -g netlify-cli
183+
- name: Prepare Netlify CLI
184+
# Control netlify-cli as a regular dev dep but expose it globally for test fixtures to use
185+
run: npm install -g "netlify-cli@$(npm list --json | jq -r ".devDependencies[\"netlify-cli\"].version")"
187186

188187
- name: Install Playwright Browsers
189188
run: npx playwright install --with-deps

tests/netlify-deploy.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -102,19 +102,19 @@ export class NextDeployInstance extends NextInstance {
102102
await fs.writeFile(path.join(this.testDir, 'netlify.toml'), toml)
103103
}
104104

105-
// ensure netlify cli is installed
105+
// ensure netlify-cli is installed
106106
try {
107-
const res = await execa('netlify', ['--version'])
107+
const res = await execa('npx', ['netlify', '--version'])
108108
require('console').log(`Using Netlify CLI version:`, res.stdout)
109109
} catch (_) {
110-
require('console').log(`You need to have netlify-cli installed.
110+
require('console').log(`netlify-cli is not installed.
111111
112-
You can do this by running: "npm install -g netlify-cli@latest" or "yarn global add netlify-cli@latest"`)
112+
Something went wrong. Try running \`npm install\`.`)
113113
}
114114

115115
// ensure project is linked
116116
try {
117-
await execa('ntl', ['status', '--json'])
117+
await execa('npx', ['netlify', 'status', '--json'])
118118
} catch (err) {
119119
if (err.message.includes("You don't appear to be in a folder that is linked to a site")) {
120120
throw new Error(`Site is not linked. Please set "NETLIFY_AUTH_TOKEN" and "NETLIFY_SITE_ID"`)
@@ -132,8 +132,8 @@ export class NextDeployInstance extends NextInstance {
132132
: testName
133133

134134
const deployRes = await execa(
135-
'ntl',
136-
['deploy', '--build', '--json', '--message', deployTitle ?? ''],
135+
'npx',
136+
['netlify', 'deploy', '--build', '--json', '--message', deployTitle ?? ''],
137137
{
138138
cwd: this.testDir,
139139
reject: false,

0 commit comments

Comments
 (0)