1
- import { intro , outro } from "@clack/prompts" ;
1
+ import { intro , log , outro } from "@clack/prompts" ;
2
2
import { prepareDeploymentError } from "@trigger.dev/core/v3" ;
3
3
import { InitializeDeploymentResponseBody } from "@trigger.dev/core/v3/schemas" ;
4
4
import { Command , Option as CommandOption } from "commander" ;
5
5
import { resolve } from "node:path" ;
6
6
import { x } from "tinyexec" ;
7
7
import { z } from "zod" ;
8
+ import { isCI } from "std-env" ;
8
9
import { CliApiClient } from "../apiClient.js" ;
9
10
import { buildWorker } from "../build/buildWorker.js" ;
10
11
import { resolveAlwaysExternal } from "../build/externals.js" ;
@@ -321,24 +322,24 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
321
322
322
323
const version = deployment . version ;
323
324
324
- const deploymentLink = cliLink (
325
- "View deployment" ,
326
- ` ${ authorization . dashboardUrl } /projects/v3/ ${ resolvedConfig . project } /deployments/ ${ deployment . shortCode } `
327
- ) ;
325
+ const rawDeploymentLink = ` ${ authorization . dashboardUrl } /projects/v3/ ${ resolvedConfig . project } /deployments/ ${ deployment . shortCode } ` ;
326
+ const rawTestLink = ` ${ authorization . dashboardUrl } /projects/v3/ ${
327
+ resolvedConfig . project
328
+ } /test?environment= ${ options . env === "prod" ? "prod" : "stg" } ` ;
328
329
329
- const testLink = cliLink (
330
- "Test tasks" ,
331
- `${ authorization . dashboardUrl } /projects/v3/${ resolvedConfig . project } /test?environment=${
332
- options . env === "prod" ? "prod" : "stg"
333
- } `
334
- ) ;
330
+ const deploymentLink = cliLink ( "View deployment" , rawDeploymentLink ) ;
331
+ const testLink = cliLink ( "Test tasks" , rawTestLink ) ;
335
332
336
333
const $spinner = spinner ( ) ;
337
334
338
- if ( isLinksSupported ) {
339
- $spinner . start ( `Building version ${ version } ${ deploymentLink } ` ) ;
335
+ if ( isCI ) {
336
+ log . step ( `Building version ${ version } \n ` ) ;
340
337
} else {
341
- $spinner . start ( `Building version ${ version } ` ) ;
338
+ if ( isLinksSupported ) {
339
+ $spinner . start ( `Building version ${ version } ${ deploymentLink } ` ) ;
340
+ } else {
341
+ $spinner . start ( `Building version ${ version } ` ) ;
342
+ }
342
343
}
343
344
344
345
const selfHostedRegistryHost = deployment . registryHost ?? options . registry ;
@@ -368,6 +369,11 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
368
369
buildEnvVars : buildManifest . build . env ,
369
370
network : options . network ,
370
371
onLog : ( logMessage ) => {
372
+ if ( isCI ) {
373
+ console . log ( logMessage ) ;
374
+ return ;
375
+ }
376
+
371
377
if ( isLinksSupported ) {
372
378
$spinner . message ( `Building version ${ version } ${ deploymentLink } : ${ logMessage } ` ) ;
373
379
} else {
@@ -441,10 +447,14 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
441
447
} `
442
448
: `${ buildResult . image } ${ buildResult . digest ? `@${ buildResult . digest } ` : "" } ` ;
443
449
444
- if ( isLinksSupported ) {
445
- $spinner . message ( `Deploying version ${ version } ${ deploymentLink } ` ) ;
450
+ if ( isCI ) {
451
+ log . step ( `Deploying version ${ version } \n ` ) ;
446
452
} else {
447
- $spinner . message ( `Deploying version ${ version } ` ) ;
453
+ if ( isLinksSupported ) {
454
+ $spinner . message ( `Deploying version ${ version } ${ deploymentLink } ` ) ;
455
+ } else {
456
+ $spinner . message ( `Deploying version ${ version } ` ) ;
457
+ }
448
458
}
449
459
450
460
const finalizeResponse = await projectClient . client . finalizeDeployment (
@@ -455,6 +465,11 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
455
465
skipPromotion : options . skipPromotion ,
456
466
} ,
457
467
( logMessage ) => {
468
+ if ( isCI ) {
469
+ console . log ( logMessage ) ;
470
+ return ;
471
+ }
472
+
458
473
if ( isLinksSupported ) {
459
474
$spinner . message ( `Deploying version ${ version } ${ deploymentLink } : ${ logMessage } ` ) ;
460
475
} else {
@@ -475,7 +490,11 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
475
490
throw new SkipLoggingError ( "Failed to finalize deployment" ) ;
476
491
}
477
492
478
- $spinner . stop ( `Successfully deployed version ${ version } ` ) ;
493
+ if ( isCI ) {
494
+ log . step ( `Successfully deployed version ${ version } ` ) ;
495
+ } else {
496
+ $spinner . stop ( `Successfully deployed version ${ version } ` ) ;
497
+ }
479
498
480
499
const taskCount = deploymentWithWorker . worker ?. tasks . length ?? 0 ;
481
500
@@ -485,6 +504,14 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
485
504
} `
486
505
) ;
487
506
507
+ if ( ! isLinksSupported ) {
508
+ console . log ( "View deployment" ) ;
509
+ console . log ( rawDeploymentLink ) ;
510
+ console . log ( ) ; // new line
511
+ console . log ( "Test tasks" ) ;
512
+ console . log ( rawTestLink ) ;
513
+ }
514
+
488
515
setGithubActionsOutputAndEnvVars ( {
489
516
envVars : {
490
517
TRIGGER_DEPLOYMENT_VERSION : version ,
0 commit comments