Hi! Is there a way to configure Unity Cloud Builds to build a project that uses some packages from a private scoped registry? Locally we use a upmconfig.toml file for authentication, but I found no way to configure this in Unity Cloud Builds. Thanks!
Hey there,
Unfortunately, this is not possible and there are no plans to support this at present.
Thatâs a shame! Not having support for it at the moment is understandable, but not having plans to support it in the near future is not. You should at least include a big warning in both Cloud Builds and UPM documentation to let people know that these two Unity technologies do not work together.
For anybody interested in solving this problem, you can do the following:
-
Create a bash script and place it somewhere in your Unity project(e.g. âAssets/CloudBuilds/Scripts/pre-build.shâ) with the following content:
#!/bin/bash
echo â[YOUR_UPM_SERVICE_ADDRESS]â >> ~/.upmconfig.toml
echo âtoken = â$NPM_TOKENââ >> ~/.upmconfig.toml
echo âemail = â$NPM_TOKEN_EMAILââ >> ~/.upmconfig.toml
echo âalwaysAuth = trueâ >> ~/.upmconfig.toml -
Open the Cloud Builds Dashboard->Config->Advanced Options->EDIT ADVANCED OPTIONS and add the path to the script created at step #1

-
Open the Cloud Builds Dashboard->Config->Environment Variables->EDIT ENVIRONMENT VARIABLES and add the following two variables:

NPM_TOKEN = your NPM access token
NPM_TOKEN_EMAIL = the email used to generate the token
You should now be able to build.
Hey @SebastianRM !
Thanks for sharing your solution, looks great but on my side Unity Cloud doesnât even think about talking to our GitLab server. I also created a global (besides the user) upmconfig file and double-checked all the content and variables.
I also did some logging within the Cloud Console; files are created as expected but the Package Manager is unable to fetch the packages from our registry and the token is not used at all.
If you have any further hints, I would appreciate it! ![]()
(My guess is, GitLab is somewhat blocking authenticationâŚ)
Cheers!
Chris
!
@SebastianRM - I do have the dependencies on nexus and tried following the same you mentioned. Created the pre-build.sh as suggested. Looks like the file .upmconfig.toml seems be getting created and able to cat the content of the file.
But for some reason, the file is not getting picked up during the build and am getting the below error message
376: [Unity] An error occurred while resolving packages:
377: [Unity] Project has invalid dependencies:
378: [Unity] games.xxxxxxx.iii-wrapper: Request [GET https://nexus.xxxxxxx.me/repository/xxxxxxx-games/games.xxxxxxx.iii-wrapper] failed because it lacks valid authentication credentials
379: [Unity] Package games.xxxxxxx.iii-wrapper@1.0.18 has invalid dependencies or related test packages:
380: [Unity] com.xxxxxxx.unity.package (dependency): Request [GET https://nexus.xxxxxxx.me/repository/xxxxxxx-unity-package/com.xxxxxxx.unity.package] failed because it lacks valid authentication credentials
Any thoughts or pointers is much appreciated !
This somehow used to work, but does not work as of now. Anyone knows how to make it work again?
Based on this post: Pre-Build Script Path windows builders - Unity Services - Unity Discussions
This script works:
#!/bin/bash
path=$USERPROFILE/.upmconfig.toml
unameOut="$(uname -s)"
case "${unameOut}" in
Darwin*) path=$HOME/.upmconfig.toml;;
esac
echo ${path}
echo "[npmAuth.'YOUR_UPM_SERVICE_ADDRESS']" >> ${path}
echo "token = '$NPM_TOKEN'" >> ${path}
echo "email = '$NPM_TOKEN_EMAIL'" >> ${path}
echo "alwaysAuth = true" >> ${path}