Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
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.'
linux64FileExtension:
default: ''
required: false
description:
'Specify the file extension of the executable when building for StandaloneLinux64. For example, ".x86_64"'

outputs:
volume:
Expand Down
10 changes: 8 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 | linux64FileExtension
${Platform.types.Android} | ${'.apk'} | ${'androidPackage'} | ${'n/a'}
${Platform.types.Android} | ${'.aab'} | ${'androidAppBundle'} | ${'n/a'}
${Platform.types.Android} | ${''} | ${'androidStudioProject'} | ${'n/a'}
${Platform.types.StandaloneWindows} | ${'.exe'} | ${'n/a'} | ${'n/a'}
${Platform.types.StandaloneWindows64} | ${'.exe'} | ${'n/a'} | ${'n/a'}
${Platform.types.StandaloneLinux64} | ${''} | ${'n/a'} | ${''}
${Platform.types.StandaloneLinux64} | ${'.x86_64'} | ${'n/a'} | ${'.x86_64'}
`(
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType',
async ({ targetPlatform, expectedExtension, androidExportType }) => {
'appends $expectedExtension for $targetPlatform with androidExportType $androidExportType and linux64FileExtension $linux64FileExtension',
async ({ targetPlatform, expectedExtension, androidExportType, linux64FileExtension }) => {
jest.spyOn(Input, 'targetPlatform', 'get').mockReturnValue(targetPlatform);
jest.spyOn(Input, 'buildName', 'get').mockReturnValue(targetPlatform);
jest.spyOn(Input, 'androidExportType', 'get').mockReturnValue(androidExportType);
jest.spyOn(Input, 'linux64FileExtension', 'get').mockReturnValue(linux64FileExtension);
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.linux64FileExtension,
);
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,
linux64FileExtension: string,
): string {
if (Platform.isWindows(platform)) {
return `${filename}.exe`;
}
Expand All @@ -243,6 +253,10 @@ class BuildParameters {
}
}

if (platform === Platform.types.StandaloneLinux64) {
return `${filename}${linux64FileExtension}`;
}

return filename;
}

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

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

it('takes input from the users workflow', () => {
const mockValue = '.x86_64';
const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue);
expect(Input.linux64FileExtension).toStrictEqual(mockValue);
expect(spy).toHaveBeenCalledTimes(1);
});
});
});
4 changes: 4 additions & 0 deletions src/model/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,10 @@ class Input {
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
}

static get linux64FileExtension(): string {
return Input.getInput('linux64FileExtension') ?? '';
}

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