@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
1515} ) : function ( o , v ) {
1616 o [ "default" ] = v ;
1717} ) ;
18- var __importStar = ( this && this . __importStar ) || function ( mod ) {
19- if ( mod && mod . __esModule ) return mod ;
20- var result = { } ;
21- if ( mod != null ) for ( var k in mod ) if ( k !== "default" && Object . prototype . hasOwnProperty . call ( mod , k ) ) __createBinding ( result , mod , k ) ;
22- __setModuleDefault ( result , mod ) ;
23- return result ;
24- } ;
18+ var __importStar = ( this && this . __importStar ) || ( function ( ) {
19+ var ownKeys = function ( o ) {
20+ ownKeys = Object . getOwnPropertyNames || function ( o ) {
21+ var ar = [ ] ;
22+ for ( var k in o ) if ( Object . prototype . hasOwnProperty . call ( o , k ) ) ar [ ar . length ] = k ;
23+ return ar ;
24+ } ;
25+ return ownKeys ( o ) ;
26+ } ;
27+ return function ( mod ) {
28+ if ( mod && mod . __esModule ) return mod ;
29+ var result = { } ;
30+ if ( mod != null ) for ( var k = ownKeys ( mod ) , i = 0 ; i < k . length ; i ++ ) if ( k [ i ] !== "default" ) __createBinding ( result , mod , k [ i ] ) ;
31+ __setModuleDefault ( result , mod ) ;
32+ return result ;
33+ } ;
34+ } ) ( ) ;
2535var __awaiter = ( this && this . __awaiter ) || function ( thisArg , _arguments , P , generator ) {
2636 function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
2737 return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
@@ -31,6 +41,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
3141 step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
3242 } ) ;
3343} ;
44+ var __importDefault = ( this && this . __importDefault ) || function ( mod ) {
45+ return ( mod && mod . __esModule ) ? mod : { "default" : mod } ;
46+ } ;
3447Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
3548exports . WebAppDeploymentProvider = void 0 ;
3649const core = __importStar ( require ( "@actions/core" ) ) ;
@@ -39,6 +52,8 @@ const zipUtility = __importStar(require("azure-actions-utility/ziputility.js"));
3952const packageUtility_1 = require ( "azure-actions-utility/packageUtility" ) ;
4053const BaseWebAppDeploymentProvider_1 = require ( "./BaseWebAppDeploymentProvider" ) ;
4154const AnnotationUtility_1 = require ( "azure-actions-appservice-rest/Utilities/AnnotationUtility" ) ;
55+ const fs_1 = __importDefault ( require ( "fs" ) ) ;
56+ const path_1 = __importDefault ( require ( "path" ) ) ;
4257class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1 . BaseWebAppDeploymentProvider {
4358 DeployWebAppStep ( ) {
4459 return __awaiter ( this , void 0 , void 0 , function * ( ) {
@@ -65,6 +80,8 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
6580 break ;
6681 case packageUtility_1 . PackageType . folder :
6782 let tempPackagePath = utility . generateTemporaryFolderOrZipPath ( `${ process . env . RUNNER_TEMP } ` , false ) ;
83+ // excluding release.zip while creating zip for deployment if it's a Linux PHP app
84+ yield this . deleteReleaseZipForLinuxPhpApps ( webPackage ) ;
6885 webPackage = ( yield zipUtility . archiveFolder ( webPackage , "" , tempPackagePath ) ) ;
6986 core . debug ( "Compressed folder into zip " + webPackage ) ;
7087 core . debug ( "Initiated deployment via kudu service for webapp package : " + webPackage ) ;
@@ -107,5 +124,45 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
107124 core . setOutput ( 'webapp-url' , this . applicationURL ) ;
108125 } ) ;
109126 }
127+ deleteReleaseZipForLinuxPhpApps ( webPackage ) {
128+ return __awaiter ( this , void 0 , void 0 , function * ( ) {
129+ const releaseZipPath = path_1 . default . join ( webPackage , 'release.zip' ) ;
130+ // Ignore if the app is not a Linux app or if release.zip does not exist
131+ if ( ! this . actionParams . isLinux || ! fs_1 . default . existsSync ( releaseZipPath ) ) {
132+ return ;
133+ }
134+ let isPhpApp = yield this . checkIfTheAppIsPhpApp ( webPackage ) ;
135+ // No need to delete release.zip for non-PHP apps
136+ if ( ! isPhpApp ) {
137+ return ;
138+ }
139+ // Delete release.zip if it exists
140+ try {
141+ yield fs_1 . default . promises . unlink ( releaseZipPath ) ;
142+ core . debug ( `Deleted release.zip` ) ;
143+ }
144+ catch ( error ) {
145+ core . debug ( `Error while deleting release.zip for Linux PHP app: ${ error } ` ) ;
146+ }
147+ } ) ;
148+ }
149+ checkIfTheAppIsPhpApp ( webPackage ) {
150+ return __awaiter ( this , void 0 , void 0 , function * ( ) {
151+ try {
152+ // Check if the webPackage folder contains a composer.json file
153+ const composerFile = 'composer.json' ;
154+ if ( fs_1 . default . existsSync ( path_1 . default . join ( webPackage , composerFile ) ) ) {
155+ return true ;
156+ }
157+ // Check if the webPackage folder contains a .php file
158+ const hasPhpFiles = fs_1 . default . readdirSync ( webPackage ) . some ( file => file . endsWith ( '.php' ) ) ;
159+ return hasPhpFiles ;
160+ }
161+ catch ( error ) {
162+ core . debug ( `Error while checking if the app is PHP: ${ error } ` ) ;
163+ }
164+ return false ;
165+ } ) ;
166+ }
110167}
111168exports . WebAppDeploymentProvider = WebAppDeploymentProvider ;
0 commit comments