Skip to content

Commit 27cd270

Browse files
unity-setup@v2.0.9 (#57)
- updated unity-cli@v1.5.0
1 parent a1e2b54 commit 27cd270

File tree

5 files changed

+72
-45
lines changed

5 files changed

+72
-45
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- name: Free Disk Space
2828
if: ${{ matrix.os == 'ubuntu-latest' && matrix.unity-version == '6000.2' }}
29-
uses: endersonmenezes/free-disk-space@v2
29+
uses: endersonmenezes/free-disk-space@713d134e243b926eba4a5cce0cf608bfd1efb89a # v2.1.1
3030
with:
3131
remove_android: true
3232
remove_dotnet: false

dist/index.js

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3779,14 +3779,17 @@ class LicensingClient {
37793779
/**
37803780
* Activates a Unity license.
37813781
* @param options The activation options including license type, services config, serial, username, and password.
3782+
* @param skipEntitlementCheck Whether to skip the entitlement check.
37823783
* @returns A promise that resolves when the license is activated.
37833784
* @throws Error if activation fails or required parameters are missing.
37843785
*/
3785-
async Activate(options) {
3786-
let activeLicenses = await this.GetActiveEntitlements();
3787-
if (activeLicenses.includes(options.licenseType)) {
3788-
this.logger.info(`License of type '${options.licenseType}' is already active, skipping activation`);
3789-
return;
3786+
async Activate(options, skipEntitlementCheck = false) {
3787+
if (!skipEntitlementCheck) {
3788+
let activeLicenses = await this.GetActiveEntitlements();
3789+
if (activeLicenses.includes(options.licenseType)) {
3790+
this.logger.info(`License of type '${options.licenseType}' is already active, skipping activation`);
3791+
return;
3792+
}
37903793
}
37913794
switch (options.licenseType) {
37923795
case LicenseType.floating: {
@@ -3988,6 +3991,14 @@ class Logger {
39883991
this.logLevel = process.env.ACTIONS_STEP_DEBUG === 'true' ? LogLevel.DEBUG : LogLevel.CI;
39893992
}
39903993
}
3994+
printLine(message, lineColor, optionalParams = []) {
3995+
if (lineColor && lineColor.length > 0) {
3996+
process.stdout.write(`${lineColor}${message}\x1b[0m\n`, ...optionalParams);
3997+
}
3998+
else {
3999+
process.stdout.write(`${message}\n`, ...optionalParams);
4000+
}
4001+
}
39914002
/**
39924003
* Logs a message to the console.
39934004
* @param level The log level for this message.
@@ -4018,15 +4029,14 @@ class Logger {
40184029
break;
40194030
}
40204031
default: {
4021-
const clear = '\x1b[0m';
40224032
const stringColor = {
40234033
[LogLevel.DEBUG]: '\x1b[35m', // Purple
4024-
[LogLevel.INFO]: clear, // No color / White
4025-
[LogLevel.CI]: clear, // No color / White
4034+
[LogLevel.INFO]: undefined, // No color / White
4035+
[LogLevel.CI]: undefined, // No color / White
40264036
[LogLevel.WARN]: '\x1b[33m', // Yellow
40274037
[LogLevel.ERROR]: '\x1b[31m', // Red
4028-
}[level] || clear; // Default to no color / White
4029-
process.stdout.write(`${stringColor}${message}${clear}\n`, ...optionalParams);
4038+
}[level] || undefined; // Default to no color / White
4039+
this.printLine(message, stringColor, optionalParams);
40304040
break;
40314041
}
40324042
}
@@ -4042,11 +4052,9 @@ class Logger {
40424052
// then print the rest of the lines inside the group in cyan color
40434053
const firstLine = message.toString().split('\n')[0];
40444054
const restLines = message.toString().split('\n').slice(1);
4045-
const cyan = '\x1b[36m';
4046-
const clear = '\x1b[0m';
40474055
process.stdout.write(`::group::${firstLine}\n`, ...optionalParams);
40484056
restLines.forEach(line => {
4049-
process.stdout.write(`${cyan}${line}${clear}\n`, ...optionalParams);
4057+
this.printLine(line, '\x1b[36m', ...optionalParams);
40504058
});
40514059
break;
40524060
}
@@ -4267,12 +4275,12 @@ class UnityEditor {
42674275
this.logger.warn(`No Unity templates found for ${this.version.toString()}`);
42684276
return undefined;
42694277
}
4270-
// Build a regex to match the template name and optional version suffix
4271-
// e.g., com.unity.template.3d(-cross-platform)?.*
4272-
// Supports files (.tgz / .tar.gz) and legacy folder templates without a suffix.
4278+
// Build a regex to match the template name, an optional numeric version suffix, and required file extension
4279+
// Example input: com.unity.template.3d(-cross-platform)?.*
4280+
// Example match: com.unity.template.3d-cross-platform-1.2.3.tar.gz or com.unity.template.3d-1.2.3.tgz
42734281
let regex;
42744282
try {
4275-
regex = new RegExp(`^${template}(?:[-.].*)?(?:\.tgz|\.tar\.gz)?$`);
4283+
regex = new RegExp(`^${template}(?:-\\d+\\.\\d+\\.\\d+)?(?:\\.tgz|\\.tar\\.gz)$`);
42764284
}
42774285
catch (e) {
42784286
throw new Error(`Invalid template regex: ${template}`);
@@ -4297,7 +4305,7 @@ class UnityEditor {
42974305
* @returns An array of available template file names.
42984306
*/
42994307
GetAvailableTemplates() {
4300-
if (this.version.isLessThan('2018.0.0')) {
4308+
if (this.version.isLessThan('2019.0.0')) {
43014309
this.logger.warn(`Unity version ${this.version.toString()} does not support project templates.`);
43024310
return [];
43034311
}
@@ -4354,19 +4362,38 @@ class UnityEditor {
43544362
if (!command.args || command.args.length === 0) {
43554363
throw Error('No command arguments provided for Unity execution');
43564364
}
4357-
if (!command.args.includes(`-automated`)) {
4358-
command.args.push(`-automated`);
4359-
}
4360-
if (!command.args.includes(`-batchmode`)) {
4361-
command.args.push(`-batchmode`);
4362-
}
43634365
if (this.autoAddNoGraphics &&
43644366
!command.args.includes(`-nographics`) &&
43654367
!command.args.includes(`-force-graphics`)) {
4366-
command.args.push(`-nographics`);
4368+
command.args.unshift(`-nographics`);
4369+
}
4370+
if (!command.args.includes(`-batchmode`)) {
4371+
command.args.unshift(`-batchmode`);
4372+
}
4373+
if (!command.args.includes(`-automated`)) {
4374+
command.args.unshift(`-automated`);
43674375
}
43684376
if (!command.args.includes('-logFile')) {
4369-
command.args.push('-logFile', this.GenerateLogFilePath(command.projectPath));
4377+
command.args.unshift('-logFile', this.GenerateLogFilePath(command.projectPath));
4378+
}
4379+
else {
4380+
const existingLogPath = (0, utilities_1.GetArgumentValueAsString)('-logFile', command.args);
4381+
command.args.splice(command.args.indexOf(existingLogPath) - 1, 2);
4382+
command.args.unshift('-logFile', existingLogPath);
4383+
}
4384+
if (command.projectPath) {
4385+
if (!command.args.includes('-projectPath')) {
4386+
command.args.unshift('-projectPath', command.projectPath);
4387+
}
4388+
else {
4389+
const existingPath = (0, utilities_1.GetArgumentValueAsString)('-projectPath', command.args);
4390+
if (existingPath !== command.projectPath) {
4391+
throw Error(`Conflicting project paths provided. Argument: "${existingPath}", Command: "${command.projectPath}"`);
4392+
}
4393+
// Ensure -projectPath is the first argument
4394+
command.args.splice(command.args.indexOf(existingPath) - 1, 2);
4395+
command.args.unshift('-projectPath', command.projectPath);
4396+
}
43704397
}
43714398
const logPath = (0, utilities_1.GetArgumentValueAsString)('-logFile', command.args);
43724399
logTail = (0, utilities_1.TailLogFile)(logPath);

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: 14 additions & 14 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.0.8",
3+
"version": "2.0.9",
44
"description": "A GitHub action for setting up the Unity Game Engine for CI/CD workflows.",
55
"author": "RageAgainstThePixel",
66
"license": "MIT",
@@ -27,12 +27,12 @@
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.4.1",
30+
"@rage-against-the-pixel/unity-cli": "^1.5.0",
3131
"semver": "^7.7.3",
3232
"yaml": "^2.8.1"
3333
},
3434
"devDependencies": {
35-
"@types/node": "^22.18.11",
35+
"@types/node": "^22.18.12",
3636
"@types/semver": "^7.7.1",
3737
"@vercel/ncc": "^0.34.0",
3838
"shx": "^0.4.0",

0 commit comments

Comments
 (0)