Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build-tests-mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ jobs:
###########################
- uses: actions/upload-artifact@v4
with:
name: Build ${{ matrix.targetPlatform }} on MacOS (${{ matrix.unityVersion }})${{ matrix.buildProfile && ' With Build Profile' || '' }}
name:
Build ${{ matrix.targetPlatform }} on MacOS (${{ matrix.unityVersion }})${{ matrix.buildProfile && ' With
Build Profile' || '' }}
Comment on lines +85 to +87
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Prevent newline insertion in artifact-name literal.

The line break inside ' With' Build Profile' injects a newline into the evaluated string, yielding a multi-line artifact name when buildProfile is set. Keep the literal on one line (or use a folded scalar) so the name stays single-line.

-        with:
-          name:
-            Build ${{ matrix.targetPlatform }} on MacOS (${{ matrix.unityVersion }})${{ matrix.buildProfile && '  With
-            Build Profile' || '' }}
+        with:
+          name: >-
+            Build ${{ matrix.targetPlatform }} on MacOS (${{ matrix.unityVersion }})${{ matrix.buildProfile && '  With Build Profile' || '' }}

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In .github/workflows/build-tests-mac.yml around lines 85 to 87, the artifact
name literal is split across lines causing a newline to be inserted when the
buildProfile branch is included; keep the entire name expression on a single
line (or replace with a folded scalar) so the conditional `'  With Build
Profile'` remains contiguous and produces a single-line artifact name; update
the YAML to remove the line break between `'  With` and `Build Profile'`
ensuring the evaluated string does not contain any embedded newlines.

path: build
retention-days: 14
6 changes: 4 additions & 2 deletions .github/workflows/build-tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- unityVersion: 6000.0.36f1
targetPlatform: StandaloneWindows64
buildProfile: 'Assets/Settings/Build Profiles/Sample Windows Build Profile.asset'

steps:
###########################
# Checkout #
Expand Down Expand Up @@ -146,6 +146,8 @@ jobs:
###########################
- uses: actions/upload-artifact@v4
with:
name: Build ${{ matrix.targetPlatform }} on Windows (${{ matrix.unityVersion }})${{ matrix.enableGpu && ' With GPU' || '' }}${{ matrix.buildProfile && ' With Build Profile' || '' }}
name:
Build ${{ matrix.targetPlatform }} on Windows (${{ matrix.unityVersion }})${{ matrix.enableGpu && ' With
GPU' || '' }}${{ matrix.buildProfile && ' With Build Profile' || '' }}
Comment on lines +149 to +151
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Avoid embedding newlines in artifact-name expressions.

Splitting the scalar across lines puts an actual newline inside the ' With …' literal, so the artifact name becomes multi-line when enableGpu is true. Keep the literal on one line or use a folded scalar to preserve readability without introducing the newline.

-        with:
-          name:
-            Build ${{ matrix.targetPlatform }} on Windows (${{ matrix.unityVersion }})${{ matrix.enableGpu && ' With
-            GPU' || '' }}${{ matrix.buildProfile && '  With Build Profile' || '' }}
+        with:
+          name: >-
+            Build ${{ matrix.targetPlatform }} on Windows (${{ matrix.unityVersion }})${{ matrix.enableGpu && ' With GPU' || '' }}${{ matrix.buildProfile && '  With Build Profile' || '' }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
name:
Build ${{ matrix.targetPlatform }} on Windows (${{ matrix.unityVersion }})${{ matrix.enableGpu && ' With
GPU' || '' }}${{ matrix.buildProfile && ' With Build Profile' || '' }}
with:
name: >-
Build ${{ matrix.targetPlatform }} on Windows (${{ matrix.unityVersion }})${{ matrix.enableGpu && ' With GPU' || '' }}${{ matrix.buildProfile && ' With Build Profile' || '' }}
🤖 Prompt for AI Agents
.github/workflows/build-tests-windows.yml around lines 149 to 151: the artifact
name scalar is split across lines so the string literal for ' With GPU' contains
a newline when enableGpu is true; fix by keeping the entire name expression on a
single line (move the ' With GPU' segment up to the same line) or convert the
scalar to a folded scalar (using >) so the expression remains readable but does
not introduce a newline into the rendered artifact name.

path: build
retention-days: 14
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ inputs:
default: 'false'
required: false
description: 'Skip the activation/deactivation of Unity. This assumes Unity is already activated.'
linux64RemoveExecutableExtension:
default: 'true'
required: false
description:
'When building for StandaloneLinux64, remove the default file extension of `.x86_64`. (This matches the behavior of older versions of this action)'

outputs:
volume:
Expand Down
11 changes: 9 additions & 2 deletions dist/index.js

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

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

19 changes: 11 additions & 8 deletions src/model/build-parameters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,21 @@ describe('BuildParameters', () => {
});

test.each`
targetPlatform | expectedExtension | androidExportType
${Platform.types.Android} | ${'.apk'} | ${'androidPackage'}
${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'}
${Platform.types.Android} | ${''} | ${'androidStudioProject'}
${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'}
${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'}
targetPlatform | expectedExtension | androidExportType | linux64RemoveExecutableExtension
${Platform.types.Android} | ${'.apk'} | ${'androidPackage'} | ${false}
${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'} | ${true}
${Platform.types.Android} | ${''} | ${'androidStudioProject'} | ${false}
${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'} | ${true}
${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'} | ${false}
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${true}
${Platform.types.StandaloneLinux64} | ${'.x86_64'} | ${'n/a'} | ${false}
`(
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType',
async ({ targetPlatform, expectedExtension, androidExportType }) => {
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType and linux64RemoveExecutableExtension $linux64RemoveExecutableExtension',
async ({ targetPlatform, expectedExtension, androidExportType, linux64RemoveExecutableExtension }) => {
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
jest.spyOn(Input, 'androidExportType', 'get').mockReturnValue(androidExportType);
jest.spyOn(Input, 'linux64RemoveExecutableExtension', 'get').mockReturnValue(linux64RemoveExecutableExtension);
await expect(BuildParameters.create()).resolves.toEqual(
expect.objectContaining({ buildFile: `${targetPlatform}${expectedExtension}` }),
);
Expand Down
18 changes: 16 additions & 2 deletions src/model/build-parameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ class BuildParameters {
}

static async create(): Promise<BuildParameters> {
const buildFile = this.parseBuildFile(Input.buildName, Input.targetPlatform, Input.androidExportType);
const buildFile = this.parseBuildFile(
Input.buildName,
Input.targetPlatform,
Input.androidExportType,
Input.linux64RemoveExecutableExtension,
);
const editorVersion = UnityVersioning.determineUnityVersion(Input.projectPath, Input.unityVersion);
const buildVersion = await Versioning.determineBuildVersion(Input.versioningStrategy, Input.specifiedVersion);
const androidVersionCode = AndroidVersioning.determineVersionCode(buildVersion, Input.androidVersionCode);
Expand Down Expand Up @@ -223,7 +228,12 @@ class BuildParameters {
};
}

static parseBuildFile(filename: string, platform: string, androidExportType: string): string {
static parseBuildFile(
filename: string,
platform: string,
androidExportType: string,
linux64RemoveExecutableExtension: boolean,
): string {
if (Platform.isWindows(platform)) {
return `${filename}.exe`;
}
Expand All @@ -243,6 +253,10 @@ class BuildParameters {
}
}

if (platform === Platform.types.StandaloneLinux64 && !linux64RemoveExecutableExtension) {
return `${filename}.x86_64`;
}

return filename;
}

Expand Down
18 changes: 18 additions & 0 deletions src/model/input.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,4 +334,22 @@ describe('Input', () => {
expect(spy).toHaveBeenCalledTimes(1);
});
});

describe('linux64RemoveExecutableExtension', () => {
it('returns the default value', () => {
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(true);
});

it('returns true when string true is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('true');
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(true);
expect(spy).toHaveBeenCalledTimes(1);
});

it('returns false when string false is passed', () => {
const spy = jest.spyOn(core, 'getInput').mockReturnValue('false');
expect(Input.linux64RemoveExecutableExtension).toStrictEqual(false);
expect(spy).toHaveBeenCalledTimes(1);
});
});
});
6 changes: 6 additions & 0 deletions src/model/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ class Input {
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
}

static get linux64RemoveExecutableExtension(): boolean {
const input = Input.getInput('linux64RemoveExecutableExtension') ?? 'true';

return input === 'true';
}

public static ToEnvVarFormat(input: string) {
if (input.toUpperCase() === input) {
return input;
Expand Down
Loading