Skip to content

Commit cd79fd3

Browse files
committed
Fix web zip format detection.
1 parent 3a1b3a1 commit cd79fd3

4 files changed

Lines changed: 79 additions & 22 deletions

File tree

.github/workflows/test-action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Test All Action Capabilities
22
on: [push]
33

44
jobs:
5-
test-all-formats:
5+
test-action:
66
runs-on: ubuntu-latest
77

88
steps:

action/dist/index.js

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -626,8 +626,15 @@ function findOutputFiles(args) {
626626
description = 'PDF';
627627
break;
628628
case 'web':
629-
expectedFile = path.join(outputDir, outputName);
630-
description = 'web directory';
629+
// Web format can be either a directory or zip file depending on web-zip option
630+
if (args['web-zip']) {
631+
expectedFile = path.join(outputDir, `${outputName}.zip`);
632+
description = 'web ZIP';
633+
}
634+
else {
635+
expectedFile = path.join(outputDir, outputName);
636+
description = 'web directory';
637+
}
631638
break;
632639
case 'ims':
633640
expectedFile = path.join(outputDir, `${outputName}.zip`);
@@ -670,14 +677,27 @@ function findOutputFiles(args) {
670677
}
671678
// Check for the expected file
672679
if (fs.existsSync(expectedFile)) {
673-
// For web format, check if it's a directory
680+
// For web format, handle both directory and zip cases
674681
if (args.format === 'web') {
675-
if (fs.statSync(expectedFile).isDirectory()) {
676-
outputFiles.push(expectedFile);
677-
core.info(`Found ${description}: ${expectedFile}`);
682+
if (args['web-zip']) {
683+
// Web ZIP format - expect a file
684+
if (fs.statSync(expectedFile).isFile()) {
685+
outputFiles.push(expectedFile);
686+
core.info(`Found ${description}: ${expectedFile}`);
687+
}
688+
else {
689+
core.warning(`Expected web ZIP file but found directory: ${expectedFile}`);
690+
}
678691
}
679692
else {
680-
core.warning(`Expected web directory but found file: ${expectedFile}`);
693+
// Web directory format - expect a directory
694+
if (fs.statSync(expectedFile).isDirectory()) {
695+
outputFiles.push(expectedFile);
696+
core.info(`Found ${description}: ${expectedFile}`);
697+
}
698+
else {
699+
core.warning(`Expected web directory but found file: ${expectedFile}`);
700+
}
681701
}
682702
}
683703
else {

action/dist/utils.js

Lines changed: 27 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

action/src/utils.ts

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,14 @@ export function findOutputFiles(args: LiaScriptExporterArgs): string[] {
126126
break;
127127

128128
case 'web':
129-
expectedFile = path.join(outputDir, outputName);
130-
description = 'web directory';
129+
// Web format can be either a directory or zip file depending on web-zip option
130+
if (args['web-zip']) {
131+
expectedFile = path.join(outputDir, `${outputName}.zip`);
132+
description = 'web ZIP';
133+
} else {
134+
expectedFile = path.join(outputDir, outputName);
135+
description = 'web directory';
136+
}
131137
break;
132138

133139
case 'ims':
@@ -175,13 +181,24 @@ export function findOutputFiles(args: LiaScriptExporterArgs): string[] {
175181

176182
// Check for the expected file
177183
if (fs.existsSync(expectedFile)) {
178-
// For web format, check if it's a directory
184+
// For web format, handle both directory and zip cases
179185
if (args.format === 'web') {
180-
if (fs.statSync(expectedFile).isDirectory()) {
181-
outputFiles.push(expectedFile);
182-
core.info(`Found ${description}: ${expectedFile}`);
186+
if (args['web-zip']) {
187+
// Web ZIP format - expect a file
188+
if (fs.statSync(expectedFile).isFile()) {
189+
outputFiles.push(expectedFile);
190+
core.info(`Found ${description}: ${expectedFile}`);
191+
} else {
192+
core.warning(`Expected web ZIP file but found directory: ${expectedFile}`);
193+
}
183194
} else {
184-
core.warning(`Expected web directory but found file: ${expectedFile}`);
195+
// Web directory format - expect a directory
196+
if (fs.statSync(expectedFile).isDirectory()) {
197+
outputFiles.push(expectedFile);
198+
core.info(`Found ${description}: ${expectedFile}`);
199+
} else {
200+
core.warning(`Expected web directory but found file: ${expectedFile}`);
201+
}
185202
}
186203
} else {
187204
outputFiles.push(expectedFile);

0 commit comments

Comments
 (0)