1- import { intro , outro } from "@clack/prompts" ;
1+ import { intro , log , outro } from "@clack/prompts" ;
22import { prepareDeploymentError } from "@trigger.dev/core/v3" ;
33import { InitializeDeploymentResponseBody } from "@trigger.dev/core/v3/schemas" ;
44import { Command , Option as CommandOption } from "commander" ;
55import { resolve } from "node:path" ;
66import { x } from "tinyexec" ;
77import { z } from "zod" ;
8+ import { isCI } from "std-env" ;
89import { CliApiClient } from "../apiClient.js" ;
910import { buildWorker } from "../build/buildWorker.js" ;
1011import { resolveAlwaysExternal } from "../build/externals.js" ;
@@ -321,24 +322,24 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
321322
322323 const version = deployment . version ;
323324
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" } ` ;
328329
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 ) ;
335332
336333 const $spinner = spinner ( ) ;
337334
338- if ( isLinksSupported ) {
339- $spinner . start ( `Building version ${ version } ${ deploymentLink } ` ) ;
335+ if ( isCI ) {
336+ log . step ( `Building version ${ version } \n ` ) ;
340337 } 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+ }
342343 }
343344
344345 const selfHostedRegistryHost = deployment . registryHost ?? options . registry ;
@@ -368,6 +369,11 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
368369 buildEnvVars : buildManifest . build . env ,
369370 network : options . network ,
370371 onLog : ( logMessage ) => {
372+ if ( isCI ) {
373+ console . log ( logMessage ) ;
374+ return ;
375+ }
376+
371377 if ( isLinksSupported ) {
372378 $spinner . message ( `Building version ${ version } ${ deploymentLink } : ${ logMessage } ` ) ;
373379 } else {
@@ -441,10 +447,14 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
441447 } `
442448 : `${ buildResult . image } ${ buildResult . digest ? `@${ buildResult . digest } ` : "" } ` ;
443449
444- if ( isLinksSupported ) {
445- $spinner . message ( `Deploying version ${ version } ${ deploymentLink } ` ) ;
450+ if ( isCI ) {
451+ log . step ( `Deploying version ${ version } \n ` ) ;
446452 } 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+ }
448458 }
449459
450460 const finalizeResponse = await projectClient . client . finalizeDeployment (
@@ -455,6 +465,11 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
455465 skipPromotion : options . skipPromotion ,
456466 } ,
457467 ( logMessage ) => {
468+ if ( isCI ) {
469+ console . log ( logMessage ) ;
470+ return ;
471+ }
472+
458473 if ( isLinksSupported ) {
459474 $spinner . message ( `Deploying version ${ version } ${ deploymentLink } : ${ logMessage } ` ) ;
460475 } else {
@@ -475,7 +490,11 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
475490 throw new SkipLoggingError ( "Failed to finalize deployment" ) ;
476491 }
477492
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+ }
479498
480499 const taskCount = deploymentWithWorker . worker ?. tasks . length ?? 0 ;
481500
@@ -485,6 +504,14 @@ async function _deployCommand(dir: string, options: DeployCommandOptions) {
485504 } `
486505 ) ;
487506
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+
488515 setGithubActionsOutputAndEnvVars ( {
489516 envVars : {
490517 TRIGGER_DEPLOYMENT_VERSION : version ,
0 commit comments