Add exit code as an output. Warning annotation on license activation retry
parent
58338a2617
commit
479005d6b7
|
@ -49,26 +49,26 @@ async function runMain() {
|
||||||
const { workspace, actionFolder } = model_1.Action;
|
const { workspace, actionFolder } = model_1.Action;
|
||||||
const buildParameters = await model_1.BuildParameters.create();
|
const buildParameters = await model_1.BuildParameters.create();
|
||||||
const baseImage = new model_1.ImageTag(buildParameters);
|
const baseImage = new model_1.ImageTag(buildParameters);
|
||||||
|
let exitCode = 0;
|
||||||
if (buildParameters.providerStrategy === 'local') {
|
if (buildParameters.providerStrategy === 'local') {
|
||||||
core.info('Building locally');
|
core.info('Building locally');
|
||||||
await platform_setup_1.default.setup(buildParameters, actionFolder);
|
await platform_setup_1.default.setup(buildParameters, actionFolder);
|
||||||
if (process.platform === 'darwin') {
|
exitCode =
|
||||||
mac_builder_1.default.run(actionFolder);
|
process.platform === 'darwin'
|
||||||
}
|
? await mac_builder_1.default.run(actionFolder)
|
||||||
else {
|
: await model_1.Docker.run(baseImage.toString(), {
|
||||||
await model_1.Docker.run(baseImage.toString(), {
|
|
||||||
workspace,
|
workspace,
|
||||||
actionFolder,
|
actionFolder,
|
||||||
...buildParameters,
|
...buildParameters,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
await model_1.CloudRunner.run(buildParameters, baseImage.toString());
|
await model_1.CloudRunner.run(buildParameters, baseImage.toString());
|
||||||
}
|
}
|
||||||
// Set output
|
// Set output
|
||||||
await model_1.Output.setBuildVersion(buildParameters.buildVersion);
|
await model_1.Output.setBuildVersion(buildParameters.buildVersion);
|
||||||
await model_1.Output.setAndroidVersionCode(buildParameters.androidVersionCode);
|
await model_1.Output.setAndroidVersionCode(buildParameters.androidVersionCode);
|
||||||
|
await model_1.Output.setExitCode(exitCode);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
@ -5913,10 +5913,10 @@ class Docker {
|
||||||
}
|
}
|
||||||
if (options) {
|
if (options) {
|
||||||
options.silent = silent;
|
options.silent = silent;
|
||||||
await (0, exec_with_error_check_1.execWithErrorCheck)(runCommand, undefined, options, errorWhenMissingUnityBuildResults);
|
return await (0, exec_with_error_check_1.execWithErrorCheck)(runCommand, undefined, options, errorWhenMissingUnityBuildResults);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await (0, exec_with_error_check_1.execWithErrorCheck)(runCommand, undefined, { silent }, errorWhenMissingUnityBuildResults);
|
return await (0, exec_with_error_check_1.execWithErrorCheck)(runCommand, undefined, { silent }, errorWhenMissingUnityBuildResults);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) {
|
static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) {
|
||||||
|
@ -6990,7 +6990,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const exec_with_error_check_1 = __nccwpck_require__(3161);
|
const exec_with_error_check_1 = __nccwpck_require__(3161);
|
||||||
class MacBuilder {
|
class MacBuilder {
|
||||||
static async run(actionFolder, silent = false) {
|
static async run(actionFolder, silent = false) {
|
||||||
await (0, exec_with_error_check_1.execWithErrorCheck)('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
|
return await (0, exec_with_error_check_1.execWithErrorCheck)('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
|
||||||
silent,
|
silent,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -7037,6 +7037,9 @@ class Output {
|
||||||
static async setAndroidVersionCode(androidVersionCode) {
|
static async setAndroidVersionCode(androidVersionCode) {
|
||||||
core.setOutput('androidVersionCode', androidVersionCode);
|
core.setOutput('androidVersionCode', androidVersionCode);
|
||||||
}
|
}
|
||||||
|
static async setExitCode(exitCode) {
|
||||||
|
core.setOutput('exitCode', exitCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports["default"] = Output;
|
exports["default"] = Output;
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -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
|
||||||
|
|
12
src/index.ts
12
src/index.ts
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue