Skip to content

Commit 4c7f2f1

Browse files
committed
Add changes to delete archived folder
1 parent 94ccc27 commit 4c7f2f1

File tree

3,582 files changed

+222000
-3949
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,582 files changed

+222000
-3949
lines changed

lib/DeploymentProvider/Providers/WebAppDeploymentProvider.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
8080
break;
8181
case packageUtility_1.PackageType.folder:
8282
let tempPackagePath = utility.generateTemporaryFolderOrZipPath(`${process.env.RUNNER_TEMP}`, false);
83-
// excluding release.zip while creating zip for deployment.
83+
// excluding release.zip while creating zip for deployment if it's a Linux PHP app
8484
yield this.deleteReleaseZipForLinuxPhpApps(webPackage);
8585
webPackage = (yield zipUtility.archiveFolder(webPackage, "", tempPackagePath));
8686
core.debug("Compressed folder into zip " + webPackage);
@@ -126,8 +126,9 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
126126
}
127127
deleteReleaseZipForLinuxPhpApps(webPackage) {
128128
return __awaiter(this, void 0, void 0, function* () {
129-
// No need to delete release.zip for non-linux apps
130-
if (!this.actionParams.isLinux) {
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)) {
131132
return;
132133
}
133134
let isPhpApp = yield this.checkIfTheAppIsPhpApp(webPackage);
@@ -137,9 +138,8 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
137138
}
138139
// Delete release.zip if it exists
139140
try {
140-
const releaseZipPath = path_1.default.join(webPackage, 'release.zip');
141141
yield fs_1.default.promises.unlink(releaseZipPath);
142-
core.debug(`Deleted release.zip for Linux PHP app: ${webPackage}`);
142+
core.debug(`Deleted release.zip`);
143143
}
144144
catch (error) {
145145
core.debug(`Error while deleting release.zip for Linux PHP app: ${error}`);
@@ -154,9 +154,9 @@ class WebAppDeploymentProvider extends BaseWebAppDeploymentProvider_1.BaseWebApp
154154
if (fs_1.default.existsSync(path_1.default.join(webPackage, composerFile))) {
155155
return true;
156156
}
157-
// Check if the web package contains a .php file
158-
const phpFiles = fs_1.default.readdirSync(webPackage).filter(file => file.endsWith('.php'));
159-
if (phpFiles.length > 0) {
157+
// Check if the webPackage folder contains a .php file
158+
const hasPhpFiles = fs_1.default.readdirSync(webPackage).some(file => file.endsWith('.php'));
159+
if (hasPhpFiles) {
160160
return true;
161161
}
162162
}

0 commit comments

Comments
 (0)