Fix pro activation (#602)
- Only randomize uuid for personal licenses - Add warning annotation for license activation retries - add `engineExitCode` output - repo/code cleanup
This commit is contained in:
88
dist/index.js
generated
vendored
88
dist/index.js
generated
vendored
@@ -49,19 +49,18 @@ async function runMain() {
|
||||
const { workspace, actionFolder } = model_1.Action;
|
||||
const buildParameters = await model_1.BuildParameters.create();
|
||||
const baseImage = new model_1.ImageTag(buildParameters);
|
||||
let exitCode = -1;
|
||||
if (buildParameters.providerStrategy === 'local') {
|
||||
core.info('Building locally');
|
||||
await platform_setup_1.default.setup(buildParameters, actionFolder);
|
||||
if (process.platform === 'darwin') {
|
||||
mac_builder_1.default.run(actionFolder);
|
||||
}
|
||||
else {
|
||||
await model_1.Docker.run(baseImage.toString(), {
|
||||
workspace,
|
||||
actionFolder,
|
||||
...buildParameters,
|
||||
});
|
||||
}
|
||||
exitCode =
|
||||
process.platform === 'darwin'
|
||||
? await mac_builder_1.default.run(actionFolder)
|
||||
: await model_1.Docker.run(baseImage.toString(), {
|
||||
workspace,
|
||||
actionFolder,
|
||||
...buildParameters,
|
||||
});
|
||||
}
|
||||
else {
|
||||
await model_1.CloudRunner.run(buildParameters, baseImage.toString());
|
||||
@@ -69,6 +68,10 @@ async function runMain() {
|
||||
// Set output
|
||||
await model_1.Output.setBuildVersion(buildParameters.buildVersion);
|
||||
await model_1.Output.setAndroidVersionCode(buildParameters.androidVersionCode);
|
||||
await model_1.Output.setEngineExitCode(exitCode);
|
||||
if (exitCode !== 0) {
|
||||
core.setFailed(`Build failed with exit code ${exitCode}`);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
@@ -3293,7 +3296,7 @@ cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||
if (fs.existsSync(`${workspace}/cloud-runner-cache`)) {
|
||||
await cloud_runner_system_1.CloudRunnerSystem.Run(`ls ${workspace}/cloud-runner-cache && du -sh ${workspace}/cloud-runner-cache`);
|
||||
}
|
||||
await docker_1.default.run(image, { workspace, actionFolder, ...this.buildParameters }, false, `chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}`, content, {
|
||||
const exitCode = await docker_1.default.run(image, { workspace, actionFolder, ...this.buildParameters }, false, `chmod +x /github/workspace/${entrypointFilePath} && /github/workspace/${entrypointFilePath}`, content, {
|
||||
listeners: {
|
||||
stdout: (data) => {
|
||||
myOutput += data.toString();
|
||||
@@ -3302,7 +3305,12 @@ cp -a ${sharedFolder}. /github/workspace/cloud-runner-cache/
|
||||
myOutput += `[LOCAL-DOCKER-ERROR]${data.toString()}`;
|
||||
},
|
||||
},
|
||||
}, true, false);
|
||||
}, true);
|
||||
// Docker doesn't exit on fail now so adding this to ensure behavior is unchanged
|
||||
// TODO: Is there a helpful way to consume the exit code or is it best to except
|
||||
if (exitCode !== 0) {
|
||||
throw new Error(`Build failed with exit code ${exitCode}`);
|
||||
}
|
||||
return myOutput;
|
||||
}
|
||||
}
|
||||
@@ -5895,14 +5903,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const exec_with_error_check_1 = __nccwpck_require__(3161);
|
||||
const image_environment_factory_1 = __importDefault(__nccwpck_require__(25145));
|
||||
const node_fs_1 = __nccwpck_require__(87561);
|
||||
const node_path_1 = __importDefault(__nccwpck_require__(49411));
|
||||
const exec_1 = __nccwpck_require__(71514);
|
||||
class Docker {
|
||||
static async run(image, parameters, silent = false, overrideCommands = '', additionalVariables = [],
|
||||
// eslint-disable-next-line unicorn/no-useless-undefined
|
||||
options = undefined, entrypointBash = false, errorWhenMissingUnityBuildResults = false) {
|
||||
static async run(image, parameters, silent = false, overrideCommands = '', additionalVariables = [], options = {}, entrypointBash = false) {
|
||||
let runCommand = '';
|
||||
switch (process.platform) {
|
||||
case 'linux':
|
||||
@@ -5911,13 +5917,9 @@ class Docker {
|
||||
case 'win32':
|
||||
runCommand = this.getWindowsCommand(image, parameters);
|
||||
}
|
||||
if (options) {
|
||||
options.silent = silent;
|
||||
await (0, exec_with_error_check_1.execWithErrorCheck)(runCommand, undefined, options, errorWhenMissingUnityBuildResults);
|
||||
}
|
||||
else {
|
||||
await (0, exec_with_error_check_1.execWithErrorCheck)(runCommand, undefined, { silent }, errorWhenMissingUnityBuildResults);
|
||||
}
|
||||
options.silent = silent;
|
||||
options.ignoreReturnCode = true;
|
||||
return await (0, exec_1.exec)(runCommand, undefined, options);
|
||||
}
|
||||
static getLinuxCommand(image, parameters, overrideCommands = '', additionalVariables = [], entrypointBash = false) {
|
||||
const { workspace, actionFolder, runnerTempPath, sshAgent, sshPublicKeysDirectoryPath, gitPrivateToken, dockerWorkspacePath, dockerCpuLimit, dockerMemoryLimit, } = parameters;
|
||||
@@ -6017,38 +6019,6 @@ class ValidationError extends Error {
|
||||
exports["default"] = ValidationError;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 3161:
|
||||
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.execWithErrorCheck = void 0;
|
||||
const exec_1 = __nccwpck_require__(71514);
|
||||
async function execWithErrorCheck(commandLine, arguments_, options, errorWhenMissingUnityBuildResults = false) {
|
||||
const result = await (0, exec_1.getExecOutput)(commandLine, arguments_, options);
|
||||
if (!errorWhenMissingUnityBuildResults) {
|
||||
return result.exitCode;
|
||||
}
|
||||
// Check for errors in the Build Results section
|
||||
const match = result.stdout.match(/^#\s*Build results\s*#(.*)^Size:/ms);
|
||||
if (match) {
|
||||
const buildResults = match[1];
|
||||
const errorMatch = buildResults.match(/^Errors:\s*(\d+)$/m);
|
||||
if (errorMatch && Number.parseInt(errorMatch[1], 10) !== 0) {
|
||||
throw new Error(`There was an error building the project. Please read the logs for details.`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Error(`There was an error building the project. Please read the logs for details.`);
|
||||
}
|
||||
return result.exitCode;
|
||||
}
|
||||
exports.execWithErrorCheck = execWithErrorCheck;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 83654:
|
||||
@@ -6987,11 +6957,12 @@ exports["default"] = Input;
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const exec_with_error_check_1 = __nccwpck_require__(3161);
|
||||
const exec_1 = __nccwpck_require__(71514);
|
||||
class MacBuilder {
|
||||
static async run(actionFolder, silent = false) {
|
||||
await (0, exec_with_error_check_1.execWithErrorCheck)('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
|
||||
return await (0, exec_1.exec)('bash', [`${actionFolder}/platforms/mac/entrypoint.sh`], {
|
||||
silent,
|
||||
ignoreReturnCode: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -7037,6 +7008,9 @@ class Output {
|
||||
static async setAndroidVersionCode(androidVersionCode) {
|
||||
core.setOutput('androidVersionCode', androidVersionCode);
|
||||
}
|
||||
static async setEngineExitCode(exitCode) {
|
||||
core.setOutput('engineExitCode', exitCode);
|
||||
}
|
||||
}
|
||||
exports["default"] = Output;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user