Skip to content

Commit 62de736

Browse files
unity-setup@v2.1.2 (#43)
- update unity-cli@1.5.3
1 parent feeb96a commit 62de736

File tree

4 files changed

+47
-46
lines changed

4 files changed

+47
-46
lines changed

dist/index.js

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4235,41 +4235,42 @@ class UnityEditor {
42354235
this.version = version;
42364236
}
42374237
this.autoAddNoGraphics = this.version.isGreaterThan('2018.0.0');
4238-
// check if we have permissions to write to this file
4239-
try {
4240-
fs.accessSync(this.editorRootPath, fs.constants.W_OK);
4241-
}
4242-
catch (error) {
4243-
return;
4244-
}
42454238
// ensure metadata.hub.json exists and has a productName entry
42464239
const hubMetaDataPath = path.join(this.editorRootPath, 'metadata.hub.json');
4247-
if (!fs.existsSync(hubMetaDataPath)) {
4248-
const metadata = {
4249-
productName: `Unity ${this.version.version.toString()}`,
4250-
entitlements: [],
4251-
releaseStream: '',
4252-
isLTS: null
4253-
};
4254-
fs.writeFileSync(hubMetaDataPath, JSON.stringify(metadata), { encoding: 'utf-8' });
4255-
}
4256-
else {
4257-
const metadataContent = fs.readFileSync(hubMetaDataPath, { encoding: 'utf-8' });
4258-
const metadata = JSON.parse(metadataContent);
4259-
if (!metadata.productName) {
4260-
// projectName must be the first property
4261-
const newMetadata = {
4262-
productName: `Unity ${this.version.version.toString()}`
4240+
try {
4241+
// check if we have permissions to write to this file
4242+
fs.accessSync(hubMetaDataPath, fs.constants.W_OK);
4243+
if (!fs.existsSync(hubMetaDataPath)) {
4244+
const metadata = {
4245+
productName: `Unity ${this.version.version.toString()}`,
4246+
entitlements: [],
4247+
releaseStream: '',
4248+
isLTS: null
42634249
};
4264-
Object.keys(metadata).forEach(key => {
4265-
if (key === 'productName') {
4266-
return;
4267-
}
4268-
newMetadata[key] = metadata[key];
4269-
});
4270-
fs.writeFileSync(hubMetaDataPath, JSON.stringify(newMetadata), { encoding: 'utf-8' });
4250+
fs.writeFileSync(hubMetaDataPath, JSON.stringify(metadata), { encoding: 'utf-8' });
4251+
}
4252+
else {
4253+
const metadataContent = fs.readFileSync(hubMetaDataPath, { encoding: 'utf-8' });
4254+
const metadata = JSON.parse(metadataContent);
4255+
if (!metadata.productName) {
4256+
// projectName must be the first property
4257+
const newMetadata = {
4258+
productName: `Unity ${this.version.version.toString()}`
4259+
};
4260+
Object.keys(metadata).forEach(key => {
4261+
if (key === 'productName') {
4262+
return;
4263+
}
4264+
newMetadata[key] = metadata[key];
4265+
});
4266+
fs.writeFileSync(hubMetaDataPath, JSON.stringify(newMetadata), { encoding: 'utf-8' });
4267+
}
42714268
}
42724269
}
4270+
catch (error) {
4271+
// ignore - we just won't be able to update the metadata file
4272+
this.logger.debug(`No write access to Unity editor root path: ${this.editorRootPath}`);
4273+
}
42734274
}
42744275
/**
42754276
* Get the full path to a Unity project template based on the provided template name or regex pattern.

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: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "unity-setup",
3-
"version": "2.1.1",
3+
"version": "2.1.2",
44
"description": "A GitHub action for setting up the Unity Game Engine for CI/CD workflows.",
55
"author": "Buildalon",
66
"license": "MIT",
@@ -27,7 +27,7 @@
2727
"@actions/core": "^1.11.1",
2828
"@actions/exec": "^1.1.1",
2929
"@actions/glob": "^0.5.0",
30-
"@rage-against-the-pixel/unity-cli": "^1.5.1",
30+
"@rage-against-the-pixel/unity-cli": "^1.5.3",
3131
"semver": "^7.7.3",
3232
"yaml": "^2.8.1"
3333
},
@@ -44,4 +44,4 @@
4444
"watch": "ncc build src/index.ts -o dist --source-map --license licenses.txt --watch",
4545
"clean": "npm install && shx rm -rf dist/ out/ node_modules/ && npm ci"
4646
}
47-
}
47+
}

0 commit comments

Comments
 (0)