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

Commit

Permalink
exec cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson committed Jul 17, 2024
1 parent 82e0b80 commit 35bffc8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 33 deletions.
31 changes: 15 additions & 16 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58493,19 +58493,21 @@ async function Run() {
core.setSecret(maskedSerial);
core.startGroup(`Activate Unity Professional License`);
var args = `-quit -batchmode -nographics -serial ${serial} -username ${username} -password ${password}`;
var exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ProLicenseActivation`);
core.endGroup();
try {
await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ProLicenseActivation`);
} finally {
core.endGroup();
}
} else if (licenseType.toLowerCase().startsWith('per')) {
// if personal license activate by using requesting activation file
core.startGroup(`Generate Unity License Request File`);
var exitCode = 0;
var args = `-quit -batchmode -nographics -createManualActivationFile`;

try {
exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ManualLicenseRequest`);
} catch (error) {
//console.error(error.message);
await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ManualLicenseRequest`);
} finally {
core.endGroup();
}
core.endGroup();

var exeDir = path.resolve(process.cwd());
core.debug(`exeDir: ${exeDir}`);
Expand Down Expand Up @@ -58549,16 +58551,13 @@ async function Run() {
args = `-quit -batchmode -nographics -manualLicenseFile ""${ulfDir}""`;

try {
exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName PersonalLicenseActivation`);
} catch (error) {
//console.error(error.message);
await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName PersonalLicenseActivation`);
} finally {
// cleanup
fs.unlink(alfPath, () => core.debug(`removed: ${alfPath}`));
fs.unlink(ulfDir, () => core.debug(`removed: ${ulfDir}`));
core.endGroup();
}

// cleanup
fs.unlink(alfPath, () => core.debug(`removed: ${alfPath}`));
fs.unlink(ulfDir, () => core.debug(`removed: ${ulfDir}`));

core.endGroup();
} else {
core.setFailed(`Invalid License type provided: '${licenseType}' | expects: 'professional' or 'personal'`);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

31 changes: 15 additions & 16 deletions src/activate.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,21 @@ async function Run() {
core.setSecret(maskedSerial);
core.startGroup(`Activate Unity Professional License`);
var args = `-quit -batchmode -nographics -serial ${serial} -username ${username} -password ${password}`;
var exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ProLicenseActivation`);
core.endGroup();
try {
await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ProLicenseActivation`);
} finally {
core.endGroup();
}
} else if (licenseType.toLowerCase().startsWith('per')) {
// if personal license activate by using requesting activation file
core.startGroup(`Generate Unity License Request File`);
var exitCode = 0;
var args = `-quit -batchmode -nographics -createManualActivationFile`;

try {
exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ManualLicenseRequest`);
} catch (error) {
//console.error(error.message);
await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName ManualLicenseRequest`);
} finally {
core.endGroup();
}
core.endGroup();

var exeDir = path.resolve(process.cwd());
core.debug(`exeDir: ${exeDir}`);
Expand Down Expand Up @@ -139,16 +141,13 @@ async function Run() {
args = `-quit -batchmode -nographics -manualLicenseFile ""${ulfDir}""`;

try {
exitCode = await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName PersonalLicenseActivation`);
} catch (error) {
//console.error(error.message);
await exec.exec(`"${pwsh}" -Command`, `${unity_action} -editorPath "${editorPath}" -projectPath "${projectPath}" -additionalArgs "${args}" -logName PersonalLicenseActivation`);
} finally {
// cleanup
fs.unlink(alfPath, () => core.debug(`removed: ${alfPath}`));
fs.unlink(ulfDir, () => core.debug(`removed: ${ulfDir}`));
core.endGroup();
}

// cleanup
fs.unlink(alfPath, () => core.debug(`removed: ${alfPath}`));
fs.unlink(ulfDir, () => core.debug(`removed: ${ulfDir}`));

core.endGroup();
} else {
core.setFailed(`Invalid License type provided: '${licenseType}' | expects: 'professional' or 'personal'`);
}
Expand Down

0 comments on commit 35bffc8

Please sign in to comment.