Closed nvandessel closed 5 months ago
@webbertakken @GabLeRoux @davidmfinol
Hey guys, wasn't sure who to tag so... :) I'd like to start tackling this problem, I've already setup what I think is the basic support for public scoped registries, however I was hoping to include the work to support private scoped registries as well. There's a few ways that we could solve this and so I wanted to open it up to discussion.
I'd like to try and support as many UPM registries types as possible. The only one I've personally used is Verdaccio (which I believe OpenUPM is also using as their backend registry), however I'd like to not be limited. In addition the authentication method with UPM registries is largely dependent on how you have decided to set it up as a user/organization.
Ultimately the most important thing is that Unity requires a .upmconfig.toml
located at a specific location dependent on your OS, which if it finds will utilize a token supplied there for authenticating with private scoped registries. I'd like to suggest that as a solution to support these private registries, we require that a consumer of the action sets a GH secret which is their private registry auth token, then during the execution of the action we pass that to run_tests.sh
shell script which can determine if the value has been provided and setup the toml for us if it has.
Curious to get your thoughts on this!
Also, shoutout to @trudeaua21 for all the work you put into supporting package testing!
Also, open to adjust the existing implementation, I didn't want to bloat things too much so just duplicated the existing test package in it's directory and renamed it to be explicit that it was for testing dependencies. I used a popular OpenUPM package UniTask as a dependency to force the test Project to resolve it. You can see it successfully do that in the logs of this run here.
I've implemented the solution I discussed above, supplying the registry token via a GitHub Actions Secret and creating the .upmconfig.toml
on the fly. Everything looks to be working for both public and private scoped registries!
Looking forward to getting some feedback!
Discovered an issue in how multiple scopes were being parsed and injected into the manifest.json
, I've fixed the issue and here's an example run showing it working: fix: multiple scopes
Also added an additional job to the main.yml
to capture this case.
@webbertakken or @GabLeRoux, would love to get some feedback on this! 🙏
Wow, that is some amazing work here. I've only did a first pass, read descriptions and comments and gave a quick look at the modified files and it looks good so far. Thanks for this great contribution! I've added a reminder to go in details through the provided code tonight.
I personally don't own a package for Unity at this time, nor one that would have external dependencies, but I do understand the feature request so I'll dig into this and add a review asap 👍
Nice one 🙌
Changes
scopedRegistryUrl
andregistryScopes
.UPM_REGISTRY_TOKEN
as an environment variable.packageMode
istrue
and we test a Unity package.scopedRegistryUrl
is provided, validation occurs to ensureregistryScopes
are supplied as wellmanifest.json
(existing functionality)manifest.json
we also add the scoped registry and its scopesUPM_REGISTRY_TOKEN
is found, then a.upmconfig.toml
is created at the$HOME
directoryRelated Issues
Related PRs
Successful Workflow Run Link
PRs don't have access to secrets so you will need to provide a link to a successful run of the workflows from your own repo.
Checklist
com.dependencyexample.testpackage
to the same directory as the existing package. By default it is setup to have a dependency from a popular OpenUPM package UniTask, and is tested via the added jobtestPackageRunnerWithScopeRegistry
.