Skip to content

Commit da3785c

Browse files
unity-setup@v1.0.14 (#17)
- reinstall unity editor if corrupted
1 parent 58cbcbe commit da3785c

File tree

5 files changed

+33
-4
lines changed

5 files changed

+33
-4
lines changed

dist/index.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34819,6 +34819,12 @@ async function Unity(version, changeset, architecture, modules) {
3481934819
}
3482034820
}
3482134821
}
34822+
catch (error) {
34823+
if (error.message.includes(`No modules found`)) {
34824+
uninstallUnity(editorPath);
34825+
await Unity(version, changeset, architecture, modules);
34826+
}
34827+
}
3482234828
finally {
3482334829
core.endGroup();
3482434830
}
@@ -34989,6 +34995,15 @@ async function getModulesContent(modulesPath) {
3498934995
const modulesContent = await (0, utility_1.ReadFileContents)(modulesPath);
3499034996
return JSON.parse(modulesContent);
3499134997
}
34998+
async function uninstallUnity(editorPath) {
34999+
core.startGroup(`Uninstalling ${editorPath}...`);
35000+
try {
35001+
await fs.promises.rm(editorPath, { recursive: true });
35002+
}
35003+
finally {
35004+
core.endGroup();
35005+
}
35006+
}
3499235007

3499335008

3499435009
/***/ }),

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "unity-setup",
3-
"version": "1.0.13",
3+
"version": "1.0.14",
44
"description": "A GitHub action for setting up the Unity Game Engine for CI/CD workflows.",
55
"author": "Buildalon",
66
"license": "MIT",

src/unity-hub.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,11 @@ async function Unity(version: string, changeset: string, architecture: string, m
255255
core.info(` > ${module}`);
256256
}
257257
}
258+
} catch (error) {
259+
if (error.message.includes(`No modules found`)) {
260+
uninstallUnity(editorPath);
261+
await Unity(version, changeset, architecture, modules);
262+
}
258263
} finally {
259264
core.endGroup();
260265
}
@@ -430,4 +435,13 @@ async function getModulesContent(modulesPath: string): Promise<any> {
430435
return JSON.parse(modulesContent);
431436
}
432437

438+
async function uninstallUnity(editorPath: string): Promise<void> {
439+
core.startGroup(`Uninstalling ${editorPath}...`);
440+
try {
441+
await fs.promises.rm(editorPath, { recursive: true });
442+
} finally {
443+
core.endGroup();
444+
}
445+
}
446+
433447
export { Get, Unity, ListInstalledEditors }

0 commit comments

Comments
 (0)