Skip to content

Commit bbd713b

Browse files
authored
Fix pro activation (#602)
- Only randomize uuid for personal licenses - Add warning annotation for license activation retries - add `engineExitCode` output - repo/code cleanup
1 parent 96cfb84 commit bbd713b

File tree

16 files changed

+84
-870
lines changed

16 files changed

+84
-870
lines changed

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,11 @@ outputs:
261261
description: 'The generated version used for the Unity build'
262262
androidVersionCode:
263263
description: 'The generated versionCode used for the Android Unity build'
264+
engineExitCode:
265+
description:
266+
'Returns the exit code from the build scripts. This code is 0 if the build was successful. If there was an error
267+
during activation, the code is from the activation step. If activation is successful, the code is from the project
268+
build step.'
264269
branding:
265270
icon: 'box'
266271
color: 'gray-dark'

dist/default-build-script/Assembly-CSharp-Editor.csproj

Lines changed: 0 additions & 709 deletions
This file was deleted.

dist/default-build-script/ProjectSettings/XRSettings.asset

Lines changed: 0 additions & 10 deletions
This file was deleted.

dist/default-build-script/default-build-script.sln

Lines changed: 0 additions & 20 deletions
This file was deleted.

dist/default-build-script/default-build-script.sln.DotSettings

Lines changed: 0 additions & 3 deletions
This file was deleted.

dist/index.js

Lines changed: 31 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/platforms/ubuntu/entrypoint.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/usr/bin/env bash
22

3-
# Ensure machine ID is randomized
4-
dbus-uuidgen > /etc/machine-id && mkdir -p /var/lib/dbus/ && ln -sf /etc/machine-id /var/lib/dbus/machine-id
3+
# Ensure machine ID is randomized for personal license activation
4+
if [[ "$UNITY_SERIAL" = F* ]]; then
5+
echo "Randomizing machine ID for personal license activation"
6+
dbus-uuidgen > /etc/machine-id && mkdir -p /var/lib/dbus/ && ln -sf /etc/machine-id /var/lib/dbus/machine-id
7+
fi
58

69
#
710
# Prepare Android SDK, if needed

dist/platforms/ubuntu/steps/activate.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ if [[ -n "$UNITY_SERIAL" && -n "$UNITY_EMAIL" && -n "$UNITY_PASSWORD" ]]; then
3535
echo "Activation successful"
3636
break
3737
else
38-
echo "Activation failed, retrying in $delay seconds..."
39-
sleep $delay
40-
4138
# Increment retry count
4239
((retry_count++))
4340

41+
echo "::warning ::Activation failed, attempting retry #$retry_count"
42+
echo "Activation failed, retrying in $delay seconds..."
43+
sleep $delay
44+
4445
# Double the delay for the next iteration
4546
delay=$((delay * 2))
4647
fi

src/index.ts

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,31 @@ async function runMain() {
1919
const buildParameters = await BuildParameters.create();
2020
const baseImage = new ImageTag(buildParameters);
2121

22+
let exitCode = -1;
23+
2224
if (buildParameters.providerStrategy === 'local') {
2325
core.info('Building locally');
2426
await PlatformSetup.setup(buildParameters, actionFolder);
25-
if (process.platform === 'darwin') {
26-
MacBuilder.run(actionFolder);
27-
} else {
28-
await Docker.run(baseImage.toString(), {
29-
workspace,
30-
actionFolder,
31-
...buildParameters,
32-
});
33-
}
27+
exitCode =
28+
process.platform === 'darwin'
29+
? await MacBuilder.run(actionFolder)
30+
: await Docker.run(baseImage.toString(), {
31+
workspace,
32+
actionFolder,
33+
...buildParameters,
34+
});
3435
} else {
3536
await CloudRunner.run(buildParameters, baseImage.toString());
3637
}
3738

3839
// Set output
3940
await Output.setBuildVersion(buildParameters.buildVersion);
4041
await Output.setAndroidVersionCode(buildParameters.androidVersionCode);
42+
await Output.setEngineExitCode(exitCode);
43+
44+
if (exitCode !== 0) {
45+
core.setFailed(`Build failed with exit code ${exitCode}`);
46+
}
4147
} catch (error) {
4248
core.setFailed((error as Error).message);
4349
}

0 commit comments

Comments
 (0)