From 6ecd75635cf82476a9976dafeb154def829980e8 Mon Sep 17 00:00:00 2001 From: Wei Wu Date: Mon, 24 Jul 2023 19:36:32 -0400 Subject: [PATCH] Add action to return license --- dist/index.js | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 5c682c64..656bf93f 100644 --- a/dist/index.js +++ b/dist/index.js @@ -52,7 +52,13 @@ async function runMain() { mac_builder_1.default.run(actionFolder); } else { - await model_1.Docker.run(baseImage.toString(), { workspace, actionFolder, ...buildParameters }); + if (buildParameters.customParameters === 'return_license') { + await model_1.Docker.run(baseImage.toString(), { workspace, actionFolder, ...buildParameters }, false, '', [], + undefined, false, true, true); + } + else { + await model_1.Docker.run(baseImage.toString(), { workspace, actionFolder, ...buildParameters }, ); + } } } else { @@ -5778,7 +5784,7 @@ const node_path_1 = __importDefault(__nccwpck_require__(49411)); class Docker { static async run(image, parameters, silent = false, overrideCommands = '', additionalVariables = [], // eslint-disable-next-line unicorn/no-useless-undefined - options = undefined, entrypointBash = false, errorWhenMissingUnityBuildResults = true) { + options = undefined, entrypointBash = false, errorWhenMissingUnityBuildResults = true, returnLicense = false) { let runCommand = ''; switch (process.platform) { case 'linux': @@ -5787,6 +5793,9 @@ class Docker { case 'win32': runCommand = this.getWindowsCommand(image, parameters); } + if (returnLicense === true) { + runCommand = this.getWindowsCommandReturnLicense(image, parameters); + } if (options) { options.silent = silent; await exec_with_error_check_1.execWithErrorCheck(runCommand, undefined, options, errorWhenMissingUnityBuildResults); @@ -5846,6 +5855,26 @@ class Docker { ${image} \ powershell c:/steps/entrypoint.ps1`; } + static getWindowsCommandReturnLicense(image, parameters) { + const { workspace, actionFolder, unitySerial, gitPrivateToken, dockerWorkspacePath } = parameters; + return `docker run \ + --workdir c:${dockerWorkspacePath} \ + --rm \ + ${image_environment_factory_1.default.getEnvVarString(parameters)} \ + --env UNITY_SERIAL="${unitySerial}" \ + --env GITHUB_WORKSPACE=c:${dockerWorkspacePath} \ + ${gitPrivateToken ? `--env GIT_PRIVATE_TOKEN="${gitPrivateToken}"` : ''} \ + --volume "${workspace}":"c:${dockerWorkspacePath}" \ + --volume "c:/regkeys":"c:/regkeys" \ + --volume "C:/Program Files (x86)/Microsoft Visual Studio":"C:/Program Files (x86)/Microsoft Visual Studio" \ + --volume "C:/Program Files (x86)/Windows Kits":"C:/Program Files (x86)/Windows Kits" \ + --volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio" \ + --volume "${actionFolder}/default-build-script":"c:/UnityBuilderAction" \ + --volume "${actionFolder}/platforms/windows":"c:/steps" \ + --volume "${actionFolder}/BlankProject":"c:/BlankProject" \ + ${image} \ + powershell c:/steps/return_license.ps1`; + } } exports["default"] = Docker;