diff --git a/action.yml b/action.yml index 7f58660e..27154ce1 100644 --- a/action.yml +++ b/action.yml @@ -251,6 +251,13 @@ inputs: default: '' required: false description: 'The Unity licensing server address to use for activating Unity.' + unityLicensingProductIds: + default: '' + required: false + description: + 'Comma separated list of license product identifiers to request licenses for from the license server. Not setting + this will request the default license product configured on the licensing server. Only applicable if + unityLicensingServer is set.' dockerWorkspacePath: default: '/github/workspace' required: false diff --git a/dist/index.js b/dist/index.js index ea151c67..d5c94f1c 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 f243b1f6..f41cf7ed 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/dist/unity-config/services-config.json.template b/dist/unity-config/services-config.json.template index 5a868f1b..9e685bf6 100644 --- a/dist/unity-config/services-config.json.template +++ b/dist/unity-config/services-config.json.template @@ -3,5 +3,6 @@ "enableEntitlementLicensing": true, "enableFloatingApi": true, "clientConnectTimeoutSec": 5, - "clientHandshakeTimeoutSec": 10 + "clientHandshakeTimeoutSec": 10, + "toolset": "%LICENSE_PRODUCT_IDS%" } diff --git a/src/model/build-parameters.test.ts b/src/model/build-parameters.test.ts index 595379d7..f689705e 100644 --- a/src/model/build-parameters.test.ts +++ b/src/model/build-parameters.test.ts @@ -200,6 +200,14 @@ describe('BuildParameters', () => { await expect(BuildParameters.create()).rejects.toThrowError(); }); + it('returns the unity licensing product ids', async () => { + const mockValue = 'license_id_1'; + jest.spyOn(Input, 'unityLicensingProductIds', 'get').mockReturnValue(mockValue); + await expect(BuildParameters.create()).resolves.toEqual( + expect.objectContaining({ unityLicensingProductIds: mockValue }), + ); + }); + it('return serial when no license server is provided', async () => { const mockValue = '123'; delete process.env.UNITY_LICENSE; // Need to delete this as it is set for every test currently diff --git a/src/model/build-parameters.ts b/src/model/build-parameters.ts index 8cf60d59..a1d69cfa 100644 --- a/src/model/build-parameters.ts +++ b/src/model/build-parameters.ts @@ -22,6 +22,7 @@ class BuildParameters { public customImage!: string; public unitySerial!: string; public unityLicensingServer!: string; + public unityLicensingProductIds!: string; public skipActivation!: string; public runnerTempPath!: string; public targetPlatform!: string; @@ -148,6 +149,7 @@ class BuildParameters { customImage: Input.customImage, unitySerial, unityLicensingServer: Input.unityLicensingServer, + unityLicensingProductIds: Input.unityLicensingProductIds, skipActivation: Input.skipActivation, runnerTempPath: Input.runnerTempPath, targetPlatform: Input.targetPlatform, diff --git a/src/model/image-environment-factory.ts b/src/model/image-environment-factory.ts index 347d6944..5b913f04 100644 --- a/src/model/image-environment-factory.ts +++ b/src/model/image-environment-factory.ts @@ -29,6 +29,10 @@ class ImageEnvironmentFactory { name: 'UNITY_LICENSING_SERVER', value: parameters.unityLicensingServer, }, + { + name: 'UNITY_LICENSING_PRODUCT_IDS', + value: parameters.unityLicensingProductIds, + }, { name: 'SKIP_ACTIVATION', value: parameters.skipActivation }, { name: 'UNITY_VERSION', value: parameters.editorVersion }, { diff --git a/src/model/input.ts b/src/model/input.ts index 0e988884..7f8691fe 100644 --- a/src/model/input.ts +++ b/src/model/input.ts @@ -123,6 +123,10 @@ class Input { return Input.getInput('unityLicensingServer') ?? ''; } + static get unityLicensingProductIds(): string { + return Input.getInput('unityLicensingProductIds') ?? ''; + } + static get buildMethod(): string { return Input.getInput('buildMethod') ?? ''; // Processed in docker file } diff --git a/src/model/platform-setup.ts b/src/model/platform-setup.ts index ad4065c8..a389a024 100644 --- a/src/model/platform-setup.ts +++ b/src/model/platform-setup.ts @@ -32,6 +32,7 @@ class PlatformSetup { let servicesConfig = fs.readFileSync(servicesConfigPathTemplate).toString(); servicesConfig = servicesConfig.replace('%URL%', buildParameters.unityLicensingServer); + servicesConfig = servicesConfig.replace('%LICENSE_PRODUCT_IDS%', buildParameters.unityLicensingProductIds); fs.writeFileSync(servicesConfigPath, servicesConfig); SetupAndroid.setup(buildParameters); diff --git a/src/model/platform-setup/setup-mac.ts b/src/model/platform-setup/setup-mac.ts index 4566e163..42770bac 100644 --- a/src/model/platform-setup/setup-mac.ts +++ b/src/model/platform-setup/setup-mac.ts @@ -168,6 +168,7 @@ class SetupMac { process.env.UNITY_VERSION = buildParameters.editorVersion; process.env.UNITY_SERIAL = buildParameters.unitySerial; process.env.UNITY_LICENSING_SERVER = buildParameters.unityLicensingServer; + process.env.UNITY_LICENSING_PRODUCT_IDS = buildParameters.unityLicensingProductIds; process.env.SKIP_ACTIVATION = buildParameters.skipActivation; process.env.PROJECT_PATH = buildParameters.projectPath; process.env.BUILD_TARGET = buildParameters.targetPlatform;