Skip to content

Commit

Permalink
unity-setup@v1.0.14 (#17)
Browse files Browse the repository at this point in the history
- reinstall unity editor if corrupted
  • Loading branch information
StephenHodgson authored Jan 14, 2025
1 parent 58cbcbe commit da3785c
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 4 deletions.
15 changes: 15 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34819,6 +34819,12 @@ async function Unity(version, changeset, architecture, modules) {
}
}
}
catch (error) {
if (error.message.includes(`No modules found`)) {
uninstallUnity(editorPath);
await Unity(version, changeset, architecture, modules);
}
}
finally {
core.endGroup();
}
Expand Down Expand Up @@ -34989,6 +34995,15 @@ async function getModulesContent(modulesPath) {
const modulesContent = await (0, utility_1.ReadFileContents)(modulesPath);
return JSON.parse(modulesContent);
}
async function uninstallUnity(editorPath) {
core.startGroup(`Uninstalling ${editorPath}...`);
try {
await fs.promises.rm(editorPath, { recursive: true });
}
finally {
core.endGroup();
}
}


/***/ }),
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "unity-setup",
"version": "1.0.13",
"version": "1.0.14",
"description": "A GitHub action for setting up the Unity Game Engine for CI/CD workflows.",
"author": "Buildalon",
"license": "MIT",
Expand Down
14 changes: 14 additions & 0 deletions src/unity-hub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,11 @@ async function Unity(version: string, changeset: string, architecture: string, m
core.info(` > ${module}`);
}
}
} catch (error) {
if (error.message.includes(`No modules found`)) {
uninstallUnity(editorPath);
await Unity(version, changeset, architecture, modules);
}
} finally {
core.endGroup();
}
Expand Down Expand Up @@ -430,4 +435,13 @@ async function getModulesContent(modulesPath: string): Promise<any> {
return JSON.parse(modulesContent);
}

async function uninstallUnity(editorPath: string): Promise<void> {
core.startGroup(`Uninstalling ${editorPath}...`);
try {
await fs.promises.rm(editorPath, { recursive: true });
} finally {
core.endGroup();
}
}

export { Get, Unity, ListInstalledEditors }

0 comments on commit da3785c

Please sign in to comment.