mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-07 20:35:33 -04:00
Add exit code as an output. Warning annotation on license activation retry
This commit is contained in:
parent
58338a2617
commit
479005d6b7
BIN
dist/index.js
generated
vendored
BIN
dist/index.js
generated
vendored
Binary file not shown.
BIN
dist/index.js.map
generated
vendored
BIN
dist/index.js.map
generated
vendored
Binary file not shown.
7
dist/platforms/ubuntu/steps/activate.sh
vendored
7
dist/platforms/ubuntu/steps/activate.sh
vendored
@ -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
|
||||
|
20
src/index.ts
20
src/index.ts
@ -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(), {
|
||||
workspace,
|
||||
actionFolder,
|
||||
...buildParameters,
|
||||
});
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user