diff --git a/action.yml b/action.yml index 1b5aff47..ef48e8c2 100644 --- a/action.yml +++ b/action.yml @@ -31,6 +31,10 @@ inputs: required: false default: '' 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: required: false default: '' diff --git a/dist/index.js b/dist/index.js index 416f12b4..9c38ab9a 100644 Binary files a/dist/index.js and b/dist/index.js differ diff --git a/dist/index.js.map b/dist/index.js.map index 5ae2fa44..ca610bdb 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/dist/platforms/ubuntu/steps/build.sh b/dist/platforms/ubuntu/steps/build.sh index 74388fc4..a066e4ed 100755 --- a/dist/platforms/ubuntu/steps/build.sh +++ b/dist/platforms/ubuntu/steps/build.sh @@ -119,7 +119,7 @@ echo "" unity-editor \ -logfile /dev/stdout \ - -quit \ + $( [ "${MANUAL_EXIT}" == "true" ] || echo "-quit" ) \ -customBuildName "$BUILD_NAME" \ -projectPath "$UNITY_PROJECT_PATH" \ -buildTarget "$BUILD_TARGET" \ diff --git a/src/model/build-parameters.ts b/src/model/build-parameters.ts index 4f430194..bd5f9103 100644 --- a/src/model/build-parameters.ts +++ b/src/model/build-parameters.ts @@ -29,6 +29,7 @@ class BuildParameters { public buildFile!: string; public buildMethod!: string; public buildVersion!: string; + public manualExit!: boolean; public androidVersionCode!: string; public androidKeystoreName!: string; public androidKeystoreBase64!: string; @@ -139,6 +140,7 @@ class BuildParameters { buildFile, buildMethod: Input.buildMethod, buildVersion, + manualExit: Input.manualExit, androidVersionCode, androidKeystoreName: Input.androidKeystoreName, androidKeystoreBase64: Input.androidKeystoreBase64, diff --git a/src/model/image-environment-factory.ts b/src/model/image-environment-factory.ts index ed780e48..c66697b4 100644 --- a/src/model/image-environment-factory.ts +++ b/src/model/image-environment-factory.ts @@ -37,6 +37,7 @@ class ImageEnvironmentFactory { { name: 'BUILD_PATH', value: parameters.buildPath }, { name: 'BUILD_FILE', value: parameters.buildFile }, { name: 'BUILD_METHOD', value: parameters.buildMethod }, + { name: 'MANUAL_EXIT', value: parameters.manualExit }, { name: 'VERSION', value: parameters.buildVersion }, { name: 'ANDROID_VERSION_CODE', value: parameters.androidVersionCode }, { name: 'ANDROID_KEYSTORE_NAME', value: parameters.androidKeystoreName }, diff --git a/src/model/input.test.ts b/src/model/input.test.ts index f5d08d5c..6a24264d 100644 --- a/src/model/input.test.ts +++ b/src/model/input.test.ts @@ -104,6 +104,24 @@ describe('Input', () => { }); }); + describe('manualExit', () => { + it('returns the default value', () => { + expect(Input.manualExit).toStrictEqual(false); + }); + + it('returns true when string true is passed', () => { + const spy = jest.spyOn(core, 'getInput').mockReturnValue('true'); + expect(Input.manualExit).toStrictEqual(true); + expect(spy).toHaveBeenCalledTimes(1); + }); + + it('returns false when string false is passed', () => { + const spy = jest.spyOn(core, 'getInput').mockReturnValue('false'); + expect(Input.manualExit).toStrictEqual(false); + expect(spy).toHaveBeenCalledTimes(1); + }); + }); + describe('versioningStrategy', () => { it('returns the default value', () => { expect(Input.versioningStrategy).toStrictEqual('Semantic'); diff --git a/src/model/input.ts b/src/model/input.ts index 011ed026..f50b0633 100644 --- a/src/model/input.ts +++ b/src/model/input.ts @@ -126,6 +126,12 @@ class Input { return Input.getInput('buildMethod') || ''; // Processed in docker file } + static get manualExit(): boolean { + const input = Input.getInput('manualExit') || false; + + return input === 'true'; + } + static get customParameters(): string { return Input.getInput('customParameters') || ''; }