Add exit code as an output. Warning annotation on license activation retry

This commit is contained in:
Andrew Kahr 2023-11-25 13:05:08 -08:00
parent 58338a2617
commit 479005d6b7
7 changed files with 25 additions and 17 deletions

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View File

@ -35,12 +35,13 @@ if [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
echo "Activation successful"
break
else
echo "Activation failed, retrying in $delay seconds..."
sleep $delay
# Increment retry count
((retry_count++))
echo "::warning ::Activation failed, attempting retry #$retry_count"
echo "Activation failed, retrying in $delay seconds..."
sleep $delay
# Double the delay for the next iteration
delay=$((delay * 2))
fi

View File

@ -19,18 +19,19 @@ async function runMain() {
const buildParameters = await BuildParameters.create();
const baseImage = new ImageTag(buildParameters);
let exitCode = 0;
if (buildParameters.providerStrategy === 'local') {
core.info('Building locally');
await PlatformSetup.setup(buildParameters, actionFolder);
if (process.platform === 'darwin') {
MacBuilder.run(actionFolder);
} else {
await Docker.run(baseImage.toString(), {
exitCode =
process.platform === 'darwin'
? await MacBuilder.run(actionFolder)
: await Docker.run(baseImage.toString(), {
workspace,
actionFolder,
...buildParameters,
});
}
} else {
await CloudRunner.run(buildParameters, baseImage.toString());
}
@ -38,6 +39,7 @@ async function runMain() {
// Set output
await Output.setBuildVersion(buildParameters.buildVersion);
await Output.setAndroidVersionCode(buildParameters.androidVersionCode);
await Output.setExitCode(exitCode);
} catch (error) {
core.setFailed((error as Error).message);
}

View File

@ -16,7 +16,7 @@ class Docker {
options: ExecOptions | undefined = undefined,
entrypointBash: boolean = false,
errorWhenMissingUnityBuildResults: boolean = false,
) {
): Promise<number> {
let runCommand = '';
switch (process.platform) {
case 'linux':
@ -27,9 +27,10 @@ class Docker {
}
if (options) {
options.silent = silent;
await execWithErrorCheck(runCommand, undefined, options, errorWhenMissingUnityBuildResults);
return await execWithErrorCheck(runCommand, undefined, options, errorWhenMissingUnityBuildResults);
} else {
await execWithErrorCheck(runCommand, undefined, { silent }, errorWhenMissingUnityBuildResults);
return await execWithErrorCheck(runCommand, undefined, { silent }, errorWhenMissingUnityBuildResults);
}
}

View File

@ -1,8 +1,8 @@
import { execWithErrorCheck } from './exec-with-error-check';
class MacBuilder {
public static async run(actionFolder: string, silent: boolean = false) {
await execWithErrorCheck('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
public static async run(actionFolder: string, silent: boolean = false): Promise<number> {
return await execWithErrorCheck('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
silent,
});
}

View File

@ -8,6 +8,10 @@ class Output {
static async setAndroidVersionCode(androidVersionCode: string) {
core.setOutput('androidVersionCode', androidVersionCode);
}
static async setExitCode(exitCode: number) {
core.setOutput('exitCode', exitCode);
}
}
export default Output;