diff --git a/action.yml b/action.yml index 7f58660e..25d2c3ae 100644 --- a/action.yml +++ b/action.yml @@ -261,6 +261,10 @@ inputs: default: 'false' required: false description: 'Skip the activation/deactivation of Unity. This assumes Unity is already activated.' + scopedRegistryUrl: + required: false + default: '' + description: 'Scoped registry to use for resolving package dependencies. Only applicable if packageMode is true.' outputs: volume: diff --git a/dist/index.js b/dist/index.js index ea151c67..c13a1440 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..cdca0fed 100644 Binary files a/dist/index.js.map and b/dist/index.js.map differ diff --git a/dist/platforms/windows/build.ps1 b/dist/platforms/windows/build.ps1 index 0a85d346..7504bfcd 100644 --- a/dist/platforms/windows/build.ps1 +++ b/dist/platforms/windows/build.ps1 @@ -24,6 +24,40 @@ Write-Output "$('Using build path "')$($Env:BUILD_PATH)$('" to save file "')$($E $Env:BUILD_PATH_FULL="$Env:GITHUB_WORKSPACE\$Env:BUILD_PATH" $Env:CUSTOM_BUILD_PATH="$Env:BUILD_PATH_FULL\$Env:BUILD_FILE" +# +# Setup token for private package registry. +# + +if ($null -ne ${env:PRIVATE_REGISTRY_TOKEN}) +{ + Write-Output "" + Write-Output "###########################" + Write-Output "# Private Registry #" + Write-Output "###########################" + Write-Output "" + Write-Output "Private registry token detected, creating .upmconfig.toml and .npmrc" + + $UPM_CONFIG_TOML_PATH="$env:USERPROFILE\.upmconfig.toml" + Write-Output "Creating toml at path: $UPM_CONFIG_TOML_PATH" + + #$NPMRC_PATH="$env:USERPROFILE\.npmrc" + #Write-Output "Creating npmrc at path: $NPMRC_PATH" + +@" +[npmAuth."${env:SCOPED_REGISTRY_URL}"] +token = "${env:PRIVATE_REGISTRY_TOKEN}" +alwaysAuth = true +"@ | Set-Content -Path "$env:USERPROFILE\.upmconfig.toml" +} +else +{ + Write-Output "" + Write-Output "###########################" + Write-Output "# Test Test #" + Write-Output "###########################" + Write-Output "" +} + # # Set the build method, must reference one of: # diff --git a/src/model/build-parameters.ts b/src/model/build-parameters.ts index 8cf60d59..7ca60f5f 100644 --- a/src/model/build-parameters.ts +++ b/src/model/build-parameters.ts @@ -94,6 +94,8 @@ class BuildParameters { public cacheUnityInstallationOnMac!: boolean; public unityHubVersionOnMac!: string; public dockerWorkspacePath!: string; + public scopedRegistryUrl!: string; + public upmRegistryToken!: string; public static shouldUseRetainedWorkspaceMode(buildParameters: BuildParameters) { return buildParameters.maxRetainedWorkspaces > 0 && CloudRunner.lockedWorkspace !== ``; @@ -218,6 +220,8 @@ class BuildParameters { cacheUnityInstallationOnMac: Input.cacheUnityInstallationOnMac, unityHubVersionOnMac: Input.unityHubVersionOnMac, dockerWorkspacePath: Input.dockerWorkspacePath, + scopedRegistryUrl: Input.scopedRegistryUrl, + upmRegistryToken: Input.upmRegistryToken, }; } diff --git a/src/model/image-environment-factory.ts b/src/model/image-environment-factory.ts index 347d6944..8a77c3eb 100644 --- a/src/model/image-environment-factory.ts +++ b/src/model/image-environment-factory.ts @@ -35,6 +35,8 @@ class ImageEnvironmentFactory { name: 'USYM_UPLOAD_AUTH_TOKEN', value: process.env.USYM_UPLOAD_AUTH_TOKEN, }, + { name: 'SCOPED_REGISTRY_URL', value: parameters.scopedRegistryUrl }, + { name: 'PRIVATE_REGISTRY_TOKEN', value: process.env.UPM_REGISTRY_TOKEN }, { name: 'PROJECT_PATH', value: parameters.projectPath }, { name: 'BUILD_TARGET', value: parameters.targetPlatform }, { name: 'BUILD_NAME', value: parameters.buildName }, diff --git a/src/model/input.ts b/src/model/input.ts index 0e988884..340a3cca 100644 --- a/src/model/input.ts +++ b/src/model/input.ts @@ -241,6 +241,18 @@ class Input { return Input.getInput('dockerCpuLimit') ?? os.cpus().length.toString(); } + static get scopedRegistryUrl(): string { + const input = Input.getInput('scopedRegistryUrl') ?? ''; + + return input !== '' ? input : ''; + } + + static get upmRegistryToken(): string { + const input = Input.getInput('UPM_REGISTRY_TOKEN') ?? ''; + + return input !== '' ? input : ''; + } + static get dockerMemoryLimit(): string { const bytesInMegabyte = 1024 * 1024; diff --git a/src/model/platform-setup/setup-mac.ts b/src/model/platform-setup/setup-mac.ts index 4566e163..794cfeb1 100644 --- a/src/model/platform-setup/setup-mac.ts +++ b/src/model/platform-setup/setup-mac.ts @@ -190,6 +190,8 @@ class SetupMac { process.env.CHOWN_FILES_TO = buildParameters.chownFilesTo; process.env.MANUAL_EXIT = buildParameters.manualExit.toString(); process.env.ENABLE_GPU = buildParameters.enableGpu.toString(); + process.env.PRIVATE_REGISTRY_TOKEN = buildParameters.upmRegistryToken; + process.env.SCOPED_REGISTRY_URL = buildParameters.scopedRegistryUrl; } }