pull/726/merge
Kitlith 2025-10-16 08:29:43 -04:00 committed by GitHub
commit 131a4cc282
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 73 additions and 16 deletions

View File

@ -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' || '' }}
path: build
retention-days: 14

View File

@ -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' || '' }}
path: build
retention-days: 14

View File

@ -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:

11
dist/index.js generated vendored
View File

@ -252,7 +252,7 @@ class BuildParameters {
return buildParameters.maxRetainedWorkspaces > 0 && cloud_runner_1.default.lockedWorkspace !== ``;
}
static async create() {
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidExportType);
const buildFile = this.parseBuildFile(input_1.default.buildName, input_1.default.targetPlatform, input_1.default.androidExportType, input_1.default.linux64RemoveExecutableExtension);
const editorVersion = unity_versioning_1.default.determineUnityVersion(input_1.default.projectPath, input_1.default.unityVersion);
const buildVersion = await versioning_1.default.determineBuildVersion(input_1.default.versioningStrategy, input_1.default.specifiedVersion);
const androidVersionCode = android_versioning_1.default.determineVersionCode(buildVersion, input_1.default.androidVersionCode);
@ -366,7 +366,7 @@ class BuildParameters {
dockerWorkspacePath: input_1.default.dockerWorkspacePath,
};
}
static parseBuildFile(filename, platform, androidExportType) {
static parseBuildFile(filename, platform, androidExportType, linux64RemoveExecutableExtension) {
if (platform_1.default.isWindows(platform)) {
return `${filename}.exe`;
}
@ -382,6 +382,9 @@ class BuildParameters {
throw new Error(`Unknown Android Export Type: ${androidExportType}. Must be one of androidPackage for apk, androidAppBundle for aab, androidStudioProject for android project`);
}
}
if (platform === platform_1.default.types.StandaloneLinux64 && !linux64RemoveExecutableExtension) {
return `${filename}.x86_64`;
}
return filename;
}
static getSerialFromLicenseFile(license) {
@ -7118,6 +7121,10 @@ class Input {
static get skipActivation() {
return Input.getInput('skipActivation')?.toLowerCase() ?? 'false';
}
static get linux64RemoveExecutableExtension() {
const input = Input.getInput('linux64RemoveExecutableExtension') ?? 'true';
return input === 'true';
}
static ToEnvVarFormat(input) {
if (input.toUpperCase() === input) {
return input;

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -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}` }),
);

View File

@ -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);
@ -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`;
}
@ -243,6 +253,10 @@ class BuildParameters {
}
}
if (platform === Platform.types.StandaloneLinux64 && !linux64RemoveExecutableExtension) {
return `${filename}.x86_64`;
}
return filename;
}

View File

@ -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);
});
});
});

View File

@ -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;