Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenHodgson committed Aug 10, 2024
1 parent ba38f3d commit b192abe
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 21 deletions.
22 changes: 13 additions & 9 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34259,20 +34259,22 @@ async function ValidateInputs() {
if (modules.length == 0) {
throw Error('No modules or build-targets provided!');
}
const versionFilePath = await getVersionFilePath();
core.info(`versionFilePath:\n > "${versionFilePath}"`);
const [unityVersion, changeset] = await getUnityVersionFromFile(versionFilePath);
const versions = getUnityVersionsFromInput();
if (versions.length === 0) {
versions.push([unityVersion, changeset]);
const versionFilePath = await getVersionFilePath();
const unityProjectPath = versionFilePath ? path.join(versionFilePath, '..', '..') : undefined;
if (versionFilePath) {
core.info(`versionFilePath:\n > "${versionFilePath}"`);
core.info(`Unity Project Path:\n > "${unityProjectPath}"`);
const [unityVersion, changeset] = await getUnityVersionFromFile(versionFilePath);
if (versions.length === 0) {
versions.push([unityVersion, changeset]);
}
}
versions.sort(([a], [b]) => semver.compare(a, b, true));
core.info(`Unity Versions:`);
for (const [version, changeset] of versions) {
core.info(` > ${version} (${changeset})`);
}
const unityProjectPath = path.join(versionFilePath, '..', '..');
core.info(`Unity Project Path:\n > "${unityProjectPath}"`);
return [versions, architecture, modules, unityProjectPath];
}

Expand Down Expand Up @@ -34374,7 +34376,7 @@ async function getVersionFilePath() {
core.debug(error);
}
}
throw Error(`Could not find ProjectVersion.txt in ${projectVersionPath}`);
debug.warning(`Could not find ProjectVersion.txt in ${process.env.GITHUB_WORKSPACE}! UNITY_PROJECT_PATH will not be set.`);
}
}

Expand Down Expand Up @@ -45390,7 +45392,9 @@ const core = __nccwpck_require__(2186);
const main = async () => {
try {
const [versions, architecture, modules, unityProjectPath] = await ValidateInputs();
core.exportVariable('UNITY_PROJECT_PATH', unityProjectPath);
if (unityProjectPath) {
core.exportVariable('UNITY_PROJECT_PATH', unityProjectPath);
}
const unityHubPath = await unityHub.Get();
core.exportVariable('UNITY_HUB_PATH', unityHubPath);
const editors = [];
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/install-unityhub-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ Write-Host "`"$tempPath`" /S"
$process = Start-Process -FilePath $tempPath -ArgumentList '/S' -PassThru -Wait
Write-Host "::endgroup::"
exit [int]$process.ExitCode

4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ const core = require('@actions/core');
const main = async () => {
try {
const [versions, architecture, modules, unityProjectPath] = await ValidateInputs();
core.exportVariable('UNITY_PROJECT_PATH', unityProjectPath);
if (unityProjectPath) {
core.exportVariable('UNITY_PROJECT_PATH', unityProjectPath);
}
const unityHubPath = await unityHub.Get();
core.exportVariable('UNITY_HUB_PATH', unityHubPath);
const editors = [];
Expand Down
18 changes: 10 additions & 8 deletions src/inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,22 @@ async function ValidateInputs() {
if (modules.length == 0) {
throw Error('No modules or build-targets provided!');
}
const versionFilePath = await getVersionFilePath();
core.info(`versionFilePath:\n > "${versionFilePath}"`);
const [unityVersion, changeset] = await getUnityVersionFromFile(versionFilePath);
const versions = getUnityVersionsFromInput();
if (versions.length === 0) {
versions.push([unityVersion, changeset]);
const versionFilePath = await getVersionFilePath();
const unityProjectPath = versionFilePath ? path.join(versionFilePath, '..', '..') : undefined;
if (versionFilePath) {
core.info(`versionFilePath:\n > "${versionFilePath}"`);
core.info(`Unity Project Path:\n > "${unityProjectPath}"`);
const [unityVersion, changeset] = await getUnityVersionFromFile(versionFilePath);
if (versions.length === 0) {
versions.push([unityVersion, changeset]);
}
}
versions.sort(([a], [b]) => semver.compare(a, b, true));
core.info(`Unity Versions:`);
for (const [version, changeset] of versions) {
core.info(` > ${version} (${changeset})`);
}
const unityProjectPath = path.join(versionFilePath, '..', '..');
core.info(`Unity Project Path:\n > "${unityProjectPath}"`);
return [versions, architecture, modules, unityProjectPath];
}

Expand Down Expand Up @@ -157,7 +159,7 @@ async function getVersionFilePath() {
core.debug(error);
}
}
throw Error(`Could not find ProjectVersion.txt in ${projectVersionPath}`);
debug.warning(`Could not find ProjectVersion.txt in ${process.env.GITHUB_WORKSPACE}! UNITY_PROJECT_PATH will not be set.`);
}
}

Expand Down
1 change: 0 additions & 1 deletion src/install-unityhub-windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ Write-Host "`"$tempPath`" /S"
$process = Start-Process -FilePath $tempPath -ArgumentList '/S' -PassThru -Wait
Write-Host "::endgroup::"
exit [int]$process.ExitCode

0 comments on commit b192abe

Please sign in to comment.