Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pro activation #602

Merged
merged 5 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
709 changes: 0 additions & 709 deletions dist/default-build-script/Assembly-CSharp-Editor.csproj

This file was deleted.

10 changes: 0 additions & 10 deletions dist/default-build-script/ProjectSettings/XRSettings.asset

This file was deleted.

20 changes: 0 additions & 20 deletions dist/default-build-script/default-build-script.sln

This file was deleted.

This file was deleted.

29 changes: 16 additions & 13 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions dist/platforms/ubuntu/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#!/usr/bin/env bash

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

#
# Prepare Android SDK, if needed
Expand Down
7 changes: 4 additions & 3 deletions dist/platforms/ubuntu/steps/activate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 11 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,27 @@ async function runMain() {
const buildParameters = await BuildParameters.create();
const baseImage = new ImageTag(buildParameters);

let exitCode = 0;
AndrewKahr marked this conversation as resolved.
Show resolved Hide resolved

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());
}

// Set output
await Output.setBuildVersion(buildParameters.buildVersion);
await Output.setAndroidVersionCode(buildParameters.androidVersionCode);
await Output.setExitCode(exitCode);
} catch (error) {
core.setFailed((error as Error).message);
}
Expand Down
7 changes: 4 additions & 3 deletions src/model/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand All @@ -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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/model/mac-builder.ts
Original file line number Diff line number Diff line change
@@ -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,
});
}
Expand Down
4 changes: 4 additions & 0 deletions src/model/output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class Output {
static async setAndroidVersionCode(androidVersionCode: string) {
core.setOutput('androidVersionCode', androidVersionCode);
}

static async setExitCode(exitCode: number) {
core.setOutput('exitCode', exitCode);
AndrewKahr marked this conversation as resolved.
Show resolved Hide resolved
}
}

export default Output;
10 changes: 0 additions & 10 deletions test-project/ProjectSettings/XRSettings.asset

This file was deleted.

Loading