@@ -35483,7 +35483,7 @@ async function ValidateInputs() {
3548335483 break;
3548435484 }
3548535485 if (architecture) {
35486- core.info(`architecture:\n > ${architecture.toLocaleLowerCase ()}`);
35486+ core.info(`architecture:\n > ${architecture.toLowerCase ()}`);
3548735487 }
3548835488 const buildTargets = getArrayInput('build-targets');
3548935489 core.info(`modules:`);
@@ -36115,7 +36115,8 @@ const retryErrorMessages = [
3611536115];
3611636116async function UnityEditor(unityVersion, modules) {
3611736117 core.info(`Getting release info for Unity ${unityVersion.toString()}...`);
36118- if (!unityVersion.isLegacy()) {
36118+ let editorPath = await checkInstalledEditors(unityVersion, false);
36119+ if (!unityVersion.isLegacy() && !editorPath) {
3611936120 try {
3612036121 const releases = await getLatestHubReleases();
3612136122 unityVersion = unityVersion.findMatch(releases);
@@ -36127,7 +36128,6 @@ async function UnityEditor(unityVersion, modules) {
3612736128 unityVersion = await fallbackVersionLookup(unityVersion);
3612836129 }
3612936130 }
36130- let editorPath = await checkInstalledEditors(unityVersion, false);
3613136131 let installPath = null;
3613236132 if (!editorPath) {
3613336133 try {
@@ -36209,7 +36209,7 @@ async function installUnity(unityVersion, modules) {
3620936209 args.push('--changeset', unityVersion.changeset);
3621036210 }
3621136211 if (unityVersion.architecture) {
36212- args.push('-a', unityVersion.architecture.toLocaleLowerCase ());
36212+ args.push('-a', unityVersion.architecture.toLowerCase ());
3621336213 }
3621436214 if (modules.length > 0) {
3621536215 for (const module of modules) {
@@ -36281,20 +36281,26 @@ async function checkInstalledEditors(unityVersion, failOnEmpty, installPath = un
3628136281 if (paths.length !== matches.length) {
3628236282 throw new Error(`Failed to parse all installed Unity Editors!`);
3628336283 }
36284- const versionMatches = matches.filter(match => unityVersion.satisfies(match.groups.version));
36285- core.debug(`Version Matches: ${JSON.stringify(versionMatches, null, 2)}`);
36286- if (versionMatches.length === 0) {
36287- return undefined;
36284+ const exactMatch = matches.find(match => match.groups.version === unityVersion.version);
36285+ if (exactMatch) {
36286+ editorPath = exactMatch.groups.editorPath;
3628836287 }
36289- for (const match of versionMatches) {
36290- if (!unityVersion.architecture || !match.groups.arch) {
36291- editorPath = match.groups.editorPath;
36292- }
36293- else if (archMap[unityVersion.architecture] === match.groups.arch) {
36294- editorPath = match.groups.editorPath;
36288+ else {
36289+ const versionMatches = matches.filter(match => unityVersion.satisfies(match.groups.version));
36290+ core.debug(`Version Matches: ${JSON.stringify(versionMatches, null, 2)}`);
36291+ if (versionMatches.length === 0) {
36292+ return undefined;
3629536293 }
36296- else if (unityVersion.architecture && match.groups.editorPath.toLowerCase().includes(`-${unityVersion.architecture.toLowerCase()}`)) {
36297- editorPath = match.groups.editorPath;
36294+ for (const match of versionMatches) {
36295+ if (!unityVersion.architecture || !match.groups.arch) {
36296+ editorPath = match.groups.editorPath;
36297+ }
36298+ else if (archMap[unityVersion.architecture] === match.groups.arch) {
36299+ editorPath = match.groups.editorPath;
36300+ }
36301+ else if (unityVersion.architecture && match.groups.editorPath.toLowerCase().includes(`-${unityVersion.architecture.toLowerCase()}`)) {
36302+ editorPath = match.groups.editorPath;
36303+ }
3629836304 }
3629936305 }
3630036306 }
@@ -36330,7 +36336,7 @@ async function checkInstalledEditors(unityVersion, failOnEmpty, installPath = un
3633036336async function checkEditorModules(editorPath, unityVersion, modules) {
3633136337 let args = ['install-modules', '--version', unityVersion.version];
3633236338 if (unityVersion.architecture) {
36333- args.push('-a', unityVersion.architecture);
36339+ args.push('-a', unityVersion.architecture.toLowerCase() );
3633436340 }
3633536341 for (const module of modules) {
3633636342 args.push('-m', module);
@@ -36456,31 +36462,48 @@ class UnityVersion {
3645636462 return semver.compare(this.semVer, '2021.0.0', true) >= 0;
3645736463 }
3645836464 findMatch(versions) {
36459- const validReleases = versions
36460- .map(release => semver.coerce(release))
36461- .filter(release => release && semver.satisfies(release, `^${this.semVer}`))
36462- .sort((a, b) => semver.compare(b, a));
36463- core.debug(`Searching for ${this.version}:`);
36464- validReleases.forEach(release => {
36465- core.debug(` > ${release}`);
36465+ const exactMatch = versions.find(r => {
36466+ const match = r.match(/(?<version>\d+\.\d+\.\d+[abcfpx]?\d*)/);
36467+ return match && match.groups && match.groups.version === this.version;
3646636468 });
36467- for (const release of validReleases) {
36468- if (!release) {
36469- continue;
36470- }
36471- const originalRelease = versions.find(r => r.includes(release.version));
36472- if (!originalRelease) {
36473- continue;
36474- }
36475- const match = originalRelease.match(/(?<version>\d+\.\d+\.\d+[abcfpx]?\d*)\s*(?:\((?<arch>Apple silicon|Intel)\))?/);
36476- if (!(match && match.groups && match.groups.version)) {
36477- continue;
36478- }
36479- if ((this.version.includes('a') && match.groups.version.includes('a')) ||
36480- (this.version.includes('b') && match.groups.version.includes('b')) ||
36481- match.groups.version.includes('f')) {
36482- core.debug(`Found Unity ${match.groups.version}`);
36483- return new UnityVersion(match.groups.version, null, this.architecture);
36469+ if (exactMatch) {
36470+ core.debug(`Exact match found for ${this.version}`);
36471+ return new UnityVersion(this.version, null, this.architecture);
36472+ }
36473+ const versionParts = this.version.match(/^(\d+)\.(\d+)\.(\d+)/);
36474+ let minorIsZero = false, patchIsZero = false;
36475+ if (versionParts) {
36476+ const [, , minor, patch] = versionParts;
36477+ minorIsZero = minor === '0';
36478+ patchIsZero = patch === '0';
36479+ }
36480+ if (minorIsZero && patchIsZero) {
36481+ const validReleases = versions
36482+ .map(release => semver.coerce(release))
36483+ .filter(release => release && semver.satisfies(release, `^${this.semVer}`))
36484+ .sort((a, b) => semver.compare(b, a));
36485+ core.debug(`Searching for fallback match for ${this.version}:`);
36486+ validReleases.forEach(release => {
36487+ core.debug(` > ${release}`);
36488+ });
36489+ for (const release of validReleases) {
36490+ if (!release) {
36491+ continue;
36492+ }
36493+ const originalRelease = versions.find(r => r.includes(release.version));
36494+ if (!originalRelease) {
36495+ continue;
36496+ }
36497+ const match = originalRelease.match(/(?<version>\d+\.\d+\.\d+[abcfpx]?\d*)\s*(?:\((?<arch>Apple silicon|Intel)\))?/);
36498+ if (!(match && match.groups && match.groups.version)) {
36499+ continue;
36500+ }
36501+ if ((this.version.includes('a') && match.groups.version.includes('a')) ||
36502+ (this.version.includes('b') && match.groups.version.includes('b')) ||
36503+ match.groups.version.includes('f')) {
36504+ core.debug(`Found fallback Unity ${match.groups.version}`);
36505+ return new UnityVersion(match.groups.version, null, this.architecture);
36506+ }
3648436507 }
3648536508 }
3648636509 core.debug(`No matching Unity version found for ${this.version}`);
0 commit comments