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" echo "Activation successful"
break break
else else
echo "Activation failed, retrying in $delay seconds..."
sleep $delay
# Increment retry count # Increment retry count
((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 # Double the delay for the next iteration
delay=$((delay * 2)) delay=$((delay * 2))
fi fi

View File

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

View File

@ -16,7 +16,7 @@ class Docker {
options: ExecOptions | undefined = undefined, options: ExecOptions | undefined = undefined,
entrypointBash: boolean = false, entrypointBash: boolean = false,
errorWhenMissingUnityBuildResults: boolean = false, errorWhenMissingUnityBuildResults: boolean = false,
) { ): Promise<number> {
let runCommand = ''; let runCommand = '';
switch (process.platform) { switch (process.platform) {
case 'linux': case 'linux':
@ -27,9 +27,10 @@ class Docker {
} }
if (options) { if (options) {
options.silent = silent; options.silent = silent;
await execWithErrorCheck(runCommand, undefined, options, errorWhenMissingUnityBuildResults);
return await execWithErrorCheck(runCommand, undefined, options, errorWhenMissingUnityBuildResults);
} else { } 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'; import { execWithErrorCheck } from './exec-with-error-check';
class MacBuilder { class MacBuilder {
public static async run(actionFolder: string, silent: boolean = false) { public static async run(actionFolder: string, silent: boolean = false): Promise<number> {
await execWithErrorCheck('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], { return await execWithErrorCheck('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
silent, silent,
}); });
} }

View File

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