manualExit suppresses -quit, useful for buildMethods with async calls

This commit is contained in:
Toby Harris 2023-09-18 10:20:41 +01:00
parent 2190fd5667
commit 3e4f343b07
8 changed files with 25 additions and 1 deletions

View File

@ -31,6 +31,10 @@ inputs:
required: false required: false
default: '' default: ''
description: 'Path to a Namespace.Class.StaticMethod to run to perform the build.' description: 'Path to a Namespace.Class.StaticMethod to run to perform the build.'
manualExit:
required: false
default: ''
description: 'Suppresses `-quit`. Exit your build method using `EditorApplication.Exit(0)` instead.'
customParameters: customParameters:
required: false required: false
default: '' default: ''

BIN
dist/index.js generated vendored

Binary file not shown.

BIN
dist/index.js.map generated vendored

Binary file not shown.

View File

@ -119,7 +119,7 @@ echo ""
unity-editor \ unity-editor \
-logfile /dev/stdout \ -logfile /dev/stdout \
-quit \ $( [ -n "${MANUAL_EXIT+set}" ] || echo "-quit" ) \
-customBuildName "$BUILD_NAME" \ -customBuildName "$BUILD_NAME" \
-projectPath "$UNITY_PROJECT_PATH" \ -projectPath "$UNITY_PROJECT_PATH" \
-buildTarget "$BUILD_TARGET" \ -buildTarget "$BUILD_TARGET" \

View File

@ -29,6 +29,7 @@ class BuildParameters {
public buildFile!: string; public buildFile!: string;
public buildMethod!: string; public buildMethod!: string;
public buildVersion!: string; public buildVersion!: string;
public manualExit!: string | undefined;
public androidVersionCode!: string; public androidVersionCode!: string;
public androidKeystoreName!: string; public androidKeystoreName!: string;
public androidKeystoreBase64!: string; public androidKeystoreBase64!: string;
@ -139,6 +140,7 @@ class BuildParameters {
buildFile, buildFile,
buildMethod: Input.buildMethod, buildMethod: Input.buildMethod,
buildVersion, buildVersion,
manualExit: Input.manualExit,
androidVersionCode, androidVersionCode,
androidKeystoreName: Input.androidKeystoreName, androidKeystoreName: Input.androidKeystoreName,
androidKeystoreBase64: Input.androidKeystoreBase64, androidKeystoreBase64: Input.androidKeystoreBase64,

View File

@ -37,6 +37,7 @@ class ImageEnvironmentFactory {
{ name: 'BUILD_PATH', value: parameters.buildPath }, { name: 'BUILD_PATH', value: parameters.buildPath },
{ name: 'BUILD_FILE', value: parameters.buildFile }, { name: 'BUILD_FILE', value: parameters.buildFile },
{ name: 'BUILD_METHOD', value: parameters.buildMethod }, { name: 'BUILD_METHOD', value: parameters.buildMethod },
{ name: 'MANUAL_EXIT', value: parameters.manualExit },
{ name: 'VERSION', value: parameters.buildVersion }, { name: 'VERSION', value: parameters.buildVersion },
{ name: 'ANDROID_VERSION_CODE', value: parameters.androidVersionCode }, { name: 'ANDROID_VERSION_CODE', value: parameters.androidVersionCode },
{ name: 'ANDROID_KEYSTORE_NAME', value: parameters.androidKeystoreName }, { name: 'ANDROID_KEYSTORE_NAME', value: parameters.androidKeystoreName },

View File

@ -104,6 +104,19 @@ describe('Input', () => {
}); });
}); });
describe('manualExit', () => {
it('returns the default value', () => {
expect(Input.manualExit).toStrictEqual(undefined);
});
it('takes input from the users workflow', () => {
const mockValue = 'x';
const spy = jest.spyOn(core, 'getInput').mockReturnValue(mockValue);
expect(Input.manualExit).toStrictEqual(mockValue);
expect(spy).toHaveBeenCalledTimes(1);
});
});
describe('versioningStrategy', () => { describe('versioningStrategy', () => {
it('returns the default value', () => { it('returns the default value', () => {
expect(Input.versioningStrategy).toStrictEqual('Semantic'); expect(Input.versioningStrategy).toStrictEqual('Semantic');

View File

@ -126,6 +126,10 @@ class Input {
return Input.getInput('buildMethod') || ''; // Processed in docker file return Input.getInput('buildMethod') || ''; // Processed in docker file
} }
static get manualExit(): string | undefined {
return Input.getInput('manualExit');
}
static get customParameters(): string { static get customParameters(): string {
return Input.getInput('customParameters') || ''; return Input.getInput('customParameters') || '';
} }