diff --git a/dist/index.js b/dist/index.js index f8abda07..ea151c67 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 9d25c910..c8ffcd06 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/dist/platforms/windows/activate.ps1 b/dist/platforms/windows/activate.ps1 index 1f630983..74ffdb58 100644 --- a/dist/platforms/windows/activate.ps1 +++ b/dist/platforms/windows/activate.ps1 @@ -50,6 +50,30 @@ if ( ($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($ Start-Sleep -Seconds 3 } } +elseif( ($null -ne ${env:UNITY_LICENSING_SERVER})) +{ + # + # Custom Unity License Server + # + + Write-Output "Adding licensing server config" + + $ACTIVATION_OUTPUT = Start-Process -FilePath "$Env:UNITY_PATH\Editor\Data\Resources\Licensing\Client\Unity.Licensing.Client.exe" ` + -ArgumentList "--acquire-floating" ` + -NoNewWindow ` + -PassThru ` + -Wait ` + -RedirectStandardOutput "license.txt" + + $PARSEDFILE = (Get-Content "license.txt" | Select-String -AllMatches -Pattern '\".*?\"' | ForEach-Object { $_.Matches.Value }) -replace '"' + + $env:FLOATING_LICENSE = $PARSEDFILE[1] + $FLOATING_LICENSE_TIMEOUT = $PARSEDFILE[3] + + Write-Output "Acquired floating license: ""$env:FLOATING_LICENSE"" with timeout $FLOATING_LICENSE_TIMEOUT" + # Store the exit code from the verify command + $ACTIVATION_EXIT_CODE = $ACTIVATION_OUTPUT.ExitCode +} else { # diff --git a/dist/platforms/windows/return_license.ps1 b/dist/platforms/windows/return_license.ps1 index edf7ec2e..66099180 100644 --- a/dist/platforms/windows/return_license.ps1 +++ b/dist/platforms/windows/return_license.ps1 @@ -6,7 +6,16 @@ Write-Output "# Return License #" Write-Output "###########################" Write-Output "" -if (($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD})) +if (($null -ne ${env:UNITY_LICENSING_SERVER})) +{ + Write-Output "Returning floating license: ""$env:FLOATING_LICENSE""" + Start-Process -FilePath "$Env:UNITY_PATH\Editor\Data\Resources\Licensing\Client\Unity.Licensing.Client.exe" ` + -ArgumentList "--return-floating ""$env:FLOATING_LICENSE"" " ` + -NoNewWindow ` + -Wait +} + +elseif (($null -ne ${env:UNITY_SERIAL}) -and ($null -ne ${env:UNITY_EMAIL}) -and ($null -ne ${env:UNITY_PASSWORD})) { # # SERIAL LICENSE MODE diff --git a/src/model/docker.ts b/src/model/docker.ts index 1beb4923..544540f7 100644 --- a/src/model/docker.ts +++ b/src/model/docker.ts @@ -113,6 +113,7 @@ class Docker { --volume "C:/ProgramData/Microsoft/VisualStudio":"C:/ProgramData/Microsoft/VisualStudio" \ --volume "${actionFolder}/default-build-script":"c:/UnityBuilderAction" \ --volume "${actionFolder}/platforms/windows":"c:/steps" \ + --volume "${actionFolder}/unity-config":"C:/ProgramData/Unity/config" \ --volume "${actionFolder}/BlankProject":"c:/BlankProject" \ --cpus=${dockerCpuLimit} \ --memory=${dockerMemoryLimit} \ diff --git a/src/model/platform-validation/validate-windows.ts b/src/model/platform-validation/validate-windows.ts index 6158c9f8..2a7b68df 100644 --- a/src/model/platform-validation/validate-windows.ts +++ b/src/model/platform-validation/validate-windows.ts @@ -4,9 +4,14 @@ import { BuildParameters } from '..'; class ValidateWindows { public static validate(buildParameters: BuildParameters) { ValidateWindows.validateWindowsPlatformRequirements(buildParameters.targetPlatform); - if (!(process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD)) { - throw new Error(`Unity email and password must be set for Windows based builds to - authenticate the license. Make sure to set them inside UNITY_EMAIL + + const { unityLicensingServer } = buildParameters; + const hasLicensingCredentials = process.env.UNITY_EMAIL && process.env.UNITY_PASSWORD; + const hasValidLicensingStrategy = hasLicensingCredentials || unityLicensingServer; + + if (!hasValidLicensingStrategy) { + throw new Error(`Unity email and password or alternatively a Unity licensing server url must be set for + Windows based builds to authenticate the license. Make sure to set them inside UNITY_EMAIL and UNITY_PASSWORD in Github Secrets and pass them into the environment.`); } }