Skip to content

Commit

Permalink
fail if nonzero exit
Browse files Browse the repository at this point in the history
  • Loading branch information
wilg committed Sep 24, 2022
1 parent 699039e commit 4c4cb5d
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
17 changes: 9 additions & 8 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ async function runMain() {
await CloudRunner.run(buildParameters, baseImage.toString());
} else {
core.info('Building locally');
let exitCode: number;
await PlatformSetup.setup(buildParameters, actionFolder);
if (process.platform === 'darwin') {
MacBuilder.run(actionFolder, workspace, buildParameters);
exitCode = await MacBuilder.run(actionFolder, workspace, buildParameters);
} else {
console.log('[node] running docker');
await Docker.run(baseImage, { workspace, actionFolder, ...buildParameters });
console.log('[node] docker exited');
exitCode = await Docker.run(baseImage, { workspace, actionFolder, ...buildParameters });
}
if (exitCode !== 0) {
core.setFailed(`Build failed with exit code ${exitCode}`);

return;
}
}

// Set output
await Output.setBuildVersion(buildParameters.buildVersion);
console.log('[node] Output.setBuildVersion completed');

} catch (error) {
core.setFailed((error as Error).message);
Expand Down
3 changes: 2 additions & 1 deletion src/model/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class Docker {
case 'win32':
runCommand = this.getWindowsCommand(image, parameters);
}
await exec(runCommand, undefined, { silent });

return await exec(runCommand, undefined, { silent });
}

static getLinuxCommand(image, parameters): string {
Expand Down
3 changes: 1 addition & 2 deletions src/model/mac-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { BuildParameters } from '.';

class MacBuilder {
public static async run(actionFolder, workspace, buildParameters: BuildParameters, silent = false) {
await exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
return await exec('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
silent,
ignoreReturnCode: false,
});
}
}
Expand Down

0 comments on commit 4c4cb5d

Please sign in to comment.