1+ import path = require( 'path' ) ;
2+ import tl = require( 'azure-pipelines-task-lib/task' ) ;
3+ import trm = require( 'azure-pipelines-task-lib/toolrunner' ) ;
4+
5+ async function run ( ) {
6+ try {
7+ tl . setResourcePath ( path . join ( __dirname , 'task.json' ) ) ;
8+
9+ var bash : trm . ToolRunner = tl . tool ( tl . which ( 'bash' , true ) ) ;
10+
11+ var scriptPath : string = path . join ( __dirname , 'launch-docker.sh' ) ;
12+
13+ var workingDirectory : string = path . dirname ( scriptPath ) ;
14+
15+ tl . mkdirP ( workingDirectory ) ;
16+ tl . cd ( workingDirectory ) ;
17+
18+ bash . arg ( scriptPath ) ;
19+
20+ bash . line ( tl . getInput ( 'args' , false ) ) ;
21+
22+ const deploymentClient = "mcr.microsoft.com/appsvc/staticappsclient:stable" ;
23+
24+ const appLocation : string = tl . getInput ( 'app_location' , false ) || "" ;
25+ const appBuildCommand : string = tl . getInput ( 'app_build_command' , false ) || "" ;
26+ const outputLoction : string = tl . getInput ( 'output_location' , false ) || "" ;
27+ const apiLocation : string = tl . getInput ( 'api_location' , false ) || "" ;
28+ const apiBuildCommand : string = tl . getInput ( 'api_build_command' , false ) || "" ;
29+ const routesLocation : string = tl . getInput ( 'routes_location' , false ) || "" ;
30+
31+ process . env [ 'SWA_APP_LOCATION' ] = appLocation ;
32+ process . env [ 'SWA_APP_BUILD_COMMAND' ] = appBuildCommand ;
33+ process . env [ 'SWA_OUTPUT_LOCATION' ] = outputLoction ;
34+ process . env [ 'SWA_API_LOCATION' ] = apiLocation ;
35+ process . env [ 'SWA_API_BUILD_COMMAND' ] = apiBuildCommand ;
36+ process . env [ 'SWA_ROUTES_LOCATION' ] = routesLocation ;
37+ process . env [ 'SWA_DEPLOYMENT_CLIENT' ] = deploymentClient ;
38+
39+ const options = {
40+ failOnStdErr : false ,
41+ } ;
42+
43+ await bash . exec ( < any > options ) ;
44+ tl . setResult ( tl . TaskResult . Succeeded , null ) ;
45+ }
46+ catch ( err ) {
47+ tl . setResult ( tl . TaskResult . Failed , null ) ;
48+ }
49+ }
50+
51+ run ( ) ;
0 commit comments