From 479005d6b7515632dce648396265005048a8f648 Mon Sep 17 00:00:00 2001 From: Andrew Kahr <22359829+AndrewKahr@users.noreply.github.com> Date: Sat, 25 Nov 2023 13:05:08 -0800 Subject: [PATCH] Add exit code as an output. Warning annotation on license activation retry --- dist/index.js | Bin 22177589 -> 22177787 bytes dist/index.js.map | Bin 14648588 -> 14648810 bytes dist/platforms/ubuntu/steps/activate.sh | 7 ++++--- src/index.ts | 20 +++++++++++--------- src/model/docker.ts | 7 ++++--- src/model/mac-builder.ts | 4 ++-- src/model/output.ts | 4 ++++ 7 files changed, 25 insertions(+), 17 deletions(-) diff --git a/dist/index.js b/dist/index.js index f55c9a5754ad0fa61144fc31a46181f3f2597b72..08c80b07870e63a3e7a23371c8ad163d2bd95083 100644 GIT binary patch delta 1725 zcmY+^X;f5Y9LMo9FbuN*4#Kb~!iXq?A`WgSil7LBxMgX(MKRW>;WmX)S>{4z<`(~w9W{YKhe_D2W@%f(T-t(OEf1dl|w(O2L5ATUMo2T2| zvjQP+U_mfcKD#d9E%ExzX$P#CMx%YB^S`%d!LF!uGw9xsV5_U0*AT2X6Bk*M9bRv# zx3-}+7&4|he5SE?yT?*&G&?FycTKd_IONDWzVJA+k1vXxIcB)SA7i>Z;#_8U#xlDZ zUYYGNn`@$MTUR;l7Ng3Qkx=o^VSLBtn_FVDe2d#$O>HgbnC|LutWkE* zX1aG+{pLE4HE7P+pB8`OF|~C{inV34S)XS+wy%|a>upBk+{EPhfzbcQaCvjzPHRTe zzn9LC)ZbVd@A;Xw*gk%n}1L04p;8#0jv z&FqeB^gs@Jq8D=ELmqmg5Ax9$1?UGq3eg_}Fc5<<7)2O@p(w^M3`Yq@pcG{oiBTxW zXjGsQV^D=^j71H`VLT>aA|~M^OvcGL1ye8;r{Xl6jx%s3&cfN4hI4Q(YH=RUM;!u~ zjtg)hf|!Asn1zc_kJ*@mxtNFf2;pK}f(9(WrD()uxExntA+E$#ScI#w7)!7e%g}^t za4oLGa$Juaa3fYAjGJ&X46M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FdK6) z7xR#X`B;F3ScJvMMh=!>DVAY5aQIuu|%HlPrKjo5_E*n+Lt zhV9sao!Eul*n_>;hy6H!A{<094&g9La0I0|iZUF-ah$+OoPrytQI0b>i*q=S3%Cdm zF5xn+;3}@+I&R=5Zs9iWpaOSs5BKo^5Ag_(@dQut4A1cbFYyYm@dj`4&i&c)UQPW8 DaY95x delta 1093 zcmX}n*;kBV0D$o`)KtSzV#HT7pR{N}%~aHgC~GLYqGU_93fT(PglJ(B^Ac0GkgX`j z5{7J9i|o{`<6m%eJZ@b4&UtR1U!~p3vXX9PLqcJtS)po7%T+5X61D%j$Z9IKniS}P zo^XI8lyHJGT%bZP^oAOJ&=;<7LqE8qKL$X9f$+c}o7FT}T`#&)wJxG9RB9IH4#`3M zY13(hT`xHay~fjBm}S{f{M1W+A|+0C5%u0$XG^IuNHnC&N?{F?oJE8|iV`^n$y-zz zBwx{Dko<*fYqW#NZr27_++>YS4wJkTBHqL3BVsbOe1uEzgcr0nYq;)rq=-qDRiZ9S zSN*?YMSg~?vejnmI-5j|!Kf6qS-KFL-B&JGTJp5&VtcTRA@Igf_`nx_@W(I&AP_+a z#&C?lNQ591dKeIfa717fMk5kYFk%d%F&5(xgYlSvSj1r>CSfwBU@E2|9@8-cGm(Hq z%))HU!CcJ4d@R61Bq14#uox*w#S)}pDVAY5R$wL4u?iVjjWt+{by$x~WFZ?Huo0V( zgU#52t=NX`$VDD@U?+AV9|b6c2}RhAJ=lw4?8APPpcG{&#{nFK85KB$N*u-!SRil| z$54giH~}lFQG=5>h0{2Lv#7;6oW}*!;UX^KGOpk%>d}B}xQ<3N;RbHPhFiFeJGhHx z+{1l5fE^F<2rYPwCwPiyc#c-Qz)QTsYrMf*w4ojE@E#rbfRFfu&-j9`_=fNJfliw} IxGON}FaJ^Us{jB1 diff --git a/dist/platforms/ubuntu/steps/activate.sh b/dist/platforms/ubuntu/steps/activate.sh index 61c649d7..efe95b83 100755 --- a/dist/platforms/ubuntu/steps/activate.sh +++ b/dist/platforms/ubuntu/steps/activate.sh @@ -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 diff --git a/src/index.ts b/src/index.ts index 2457eb1d..413ace33 100644 --- a/src/index.ts +++ b/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); } diff --git a/src/model/docker.ts b/src/model/docker.ts index 50cbf69f..815bccae 100644 --- a/src/model/docker.ts +++ b/src/model/docker.ts @@ -16,7 +16,7 @@ class Docker { options: ExecOptions | undefined = undefined, entrypointBash: boolean = false, errorWhenMissingUnityBuildResults: boolean = false, - ) { + ): Promise { 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); } } diff --git a/src/model/mac-builder.ts b/src/model/mac-builder.ts index eb9ec683..7524f961 100644 --- a/src/model/mac-builder.ts +++ b/src/model/mac-builder.ts @@ -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 { + return await execWithErrorCheck('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], { silent, }); } diff --git a/src/model/output.ts b/src/model/output.ts index 1d71bf86..2169e3b2 100644 --- a/src/model/output.ts +++ b/src/model/output.ts @@ -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;