Add support for Github Package Registry

Hello,

Long time lurker first time poster. I really love the direction Unity is going with the package manager but with the advent of some of the developments with Github I would like to see the package manager not only support git urls but it should now support the Github Package Registry.

Here is an example unity library I wrote and here is what the package.json need to look like to beable to publish the resulting “package” to github - https://github.com/red-owl-games/UIEX/blob/a1a2696555a585feda73640ac3847668a051fe11/package.json

You can view the package here - https://github.com/red-owl-games/UIEX/packages/32700
and here is the github documentation on configuring NPM to download that package “unauth’d” - Working with the npm registry - GitHub Docs

That being said - i’ve tried and it seems to come down to the fact that unity is forcing a “domain reverse lookup” style on the naming of packages.

When i configure my project manifest.json file like so

{
  "scopedRegistries": [
    {
      "name": "RedOwl",
      "url": "https://npm.pkg.github.com/red-owl-games",
      "scopes": [
        "com.redowlgames"
      ]
    }
  ],
  "dependencies": {
    "com.redowlgames.uiex": "1.0.0"
  }
}

I get the error

An error occurred while resolving packages:
  Project has invalid dependencies:
    com.redowlgames.uiex: Request [GET https://npm.pkg.github.com/red-owl-games/com.redowlgames.uiex] failed with status code [401]

Since you guys seem to be trying to closely (but no 100% adhere to the NPM spec) it seems like you could easily support this by allowing the following

{
  "scopedRegistries": [
    {
      "name": "RedOwl",
      "url": "https://npm.pkg.github.com/red-owl-games",
      "scopes": [
        "@red-owl-games"
      ]
    }
  ],
  "dependencies": {
    "@red-owl-games/uiex": "1.0.0"
  }
}

and thus building the request as https://npm.pkg.github.com/red-owl-games/uiex

but doing the above results in the seemingly forced error on Unity’s side of

An error occurred while resolving packages:
  Project has invalid dependencies:
    @red-owl-games/uiex: Package name '@red-owl-games/uiex' is invalid.

If Unity package manager would support Github Package Registry - it would be a huge boon to opensource package managers (and likely Unity itself could use it because of the number of new github based projects unity is pushing)

Cheers!

4 Likes

Hi @[Rocktavious]( Add support for Github Package Registry members/rocktavious.1375528/),

Thank you very much for this in-depth analysis. This will be useful if we ever implement this feature. More and more users like are asking for Unity to support this registry. I think we will get there. Btw, this request can be made both ways. In other words, you could reach out to GitHub and ask them to support Unity scoped registries ️. I’ll share your investigation with the team.

Thank you again! Regards,

Pascal

1 Like

@Rocktavious , I posted a thread explaining how to configure GitHub Packages registry here . Come with some caveats.

Regards,

Pascal

2 Likes