Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson committed Jul 18, 2024
1 parent 59b8ac3 commit a87d6be
Show file tree
Hide file tree
Showing 15 changed files with 10 additions and 1,697 deletions.
9 changes: 0 additions & 9 deletions .puppeteerrc.cjs

This file was deleted.

77 changes: 3 additions & 74 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26156,34 +26156,18 @@ exports["default"] = _default;

const core = __nccwpck_require__(2186);
const exec = __nccwpck_require__(1514);
const io = __nccwpck_require__(7436);
const fs = __nccwpck_require__(7147);
const path = __nccwpck_require__(1017);
const { readdir } = __nccwpck_require__(3292);
const platform = process.platform;

async function retry(fn, retries = 3) {
let lastError;
for (let i = 0; i < retries; i++) {
try {
await fn();
return;
} catch (error) {
lastError = error;
core.warning(`Attempt ${i + 1} failed: ${error.message}`);
await new Promise(r => setTimeout(r, 2000 * i));
}
}
throw lastError;
}

async function Run() {
try {
if (hasExistingLicense()) {
core.info('Unity License already activated!');
return;
} else {
core.info('Attempting to activate Unity License...');
core.debug('Attempting to activate Unity License...');
}

var editorPath = process.env.UNITY_EDITOR_PATH;
Expand Down Expand Up @@ -26230,68 +26214,13 @@ async function Run() {
throw Error('Unable to find Unity License!');
}

var entitlements = '';
await exec.exec(`"${licenseClient}" --showEntitlements`, {
listeners: {
stdout: (data) => {
entitlements += data.toString();
}
}
});
var serial = entitlements.match(/EntitlementGroupId: ([A-Z0-9-]+)/)[1];
var maskedSerial = serial.slice(0, -4) + `XXXX`;
core.setSecret(maskedSerial);
await exec.exec(`"${licenseClient}" --showEntitlements`);
} catch (error) {
core.setFailed(`Unity License Activation Failed! ${error.message}`);
GetLogs();
}
}

const findByExtension = async (dir, ext) => {
const directories = [];
const matchedFiles = [];
const files = await readdir(dir);

for (const file of files) {
const item = path.resolve(dir, file);

if (fs.statSync(`${dir}/${file}`).isDirectory()) {
directories.push(item);
} else if (file.endsWith(ext)) {
core.debug(`--> Found! ${item}`);
matchedFiles.push(item);
break;
}
}

if (matchedFiles.length == 0) {
for (const subDir of directories) {
const nestedMatches = await findByExtension(subDir, ext);

for (const nestedMatch of nestedMatches) {
matchedFiles.push(nestedMatch);
break;
}
}
}

return matchedFiles;
};

const findWorkspace = async (dir) => {
core.debug(`Searching for .git root in: ${dir}`);
const files = await readdir(dir);

for (const file of files) {
if (file.match('\.git')) {
return path.resolve(dir);
}
}

const result = await findWorkspace(path.resolve(dir, '..'));
return result;
};

const getLicensingClient = () => {
// Windows: <UnityEditorDir>\Data\Resources\Licensing\Client
// macOS (Editor versions 2021.3.19f1 or later): <UnityEditorDir>/Contents/Frameworks/UnityLicensingClient.app/Contents/MacOS/
Expand Down Expand Up @@ -26496,7 +26425,7 @@ async function Run() {
}

var pwsh = await io.which("pwsh", true);
var unity_action = __nccwpck_require__.ab + "unity-action.ps1";
var unity_action = path.resolve(__dirname, 'unity-action.ps1');
// -quit -batchmode -nographics -returnlicense -username [email protected] -password XXXXXXXXXXXXX
var args = `-quit -batchmode -nographics -returnlicense -username ${username} -password ${password}`;
var exitCode = 0;
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit a87d6be

Please sign in to comment.