This package is used to store metadata about other Unity packages.
It is used by the Package Manager server to fulfill client requests.
In Unity 2018.3, UPM supported scoped package registry.
A scoped registry allows you to use a registry in addition to the Unity default registry where you can host your own packages.
In addition, you can use 3rd-party registries such as openupm, xcrew.dev and upm-packages.dev.
However, to use a scoped registry, you must add a scopedRegistries
field in Packages/manifest.json
.
You also need to add a scopes
field depending on the package domains.
This feels a little annoying.
{
"scopedRegistries": [
{
"name": "YourPackageRegistry",
"url": "https://your.package.registry.com",
"scopes": [
"com.your.package-one",
"com.another.package-two",
...
]
}
],
"dependencies": {
"com.your.package-one": "1.0.0",
"com.another.package-two": "2.0.0",
...
}
}
The UPM system searches the packages based on a metadata package com.unity.package-manager.metadata
.
The package contains a list of all packages searchable in the UI.
See searchablePackages
field.
If you use verdaccio for package registry, this repository will benefit you.
Package Manager UI
without any editor extensions.scopedRegistories
field in manifest.json
is no longer needed.
registry
field (supported in Unity 2017.x or later.){
"registry": "https://your.package.registry.com",
"dependencies": {
"com.your.package-one": "1.0.0",
"com.another.package-two": "2.0.0",
...
}
}
This repository works on GitHub Actions.
If you update locally, request the following:
publishConfig.registry
field in package.json
to the URL of your package registry."publishConfig": {
"registry": "https://your.package.registry.com"
},
.github/workflows/update.yml
as following to change the schedule:on:
schedule:
# check the official package registry daily.
- cron: "* 0 * * *"
The workflow will push updates to the repository.
See Creating secrets in GitHub and add GH_TOKEN
secret on GitHub.
(Optional) To publish this package to your package registry, follow these steps:
NPM_TOKEN
secret on GitHub. For details, see Creating secrets in GitHub..releaserc
as follows:{
"plugins": [
[
"@semantic-release/npm",
{
"npmPublish": true
}
],
...
]
}
Verdaccio has a feature called uplinks.
Packages that do not exist in your package registry can be found from an proxy registry.
For example, the com.unity.*
packages will be found from Unity official package registry.
In addition, multiple proxies can be configured using uplinks.
Edit the verdaccio configuration file config.yml
as follows:
uplinks:
# the official package registry
unity:
url: https://packages.unity.com
# the third party package registry (e.g. openupm)
third_party:
url: https://packages.third.party.com
packages:
# the metadata package should be found in your package registry
"com.unity.package-manager.metadata":
access: $all
publish: $authenticated
# unity official packages should be found in official package registry
"com.unity.*":
access: $all
proxy: unity
# other packages
"**":
access: $all
publish: $authenticated
unpublish: $authenticated
# if package is not available locally, proxy requests to other registries
proxy:
- third_party
- unity
# notify to GitHub Actions on published a new package
notify:
method: POST
headers:
[
{ "Content-Type": "application/json" },
{ "Accept": "application/vnd.github.v3+json" },
{ "User-Agent": "verdaccio" },
{ "Authorization": "token {GITHUB_TOKEN}" },
]
endpoint: "https://api.github.com/repos/{OWNER}/unity.package-manager.metadata/dispatches"
content: '{ "event_type":"package_published", "client_payload": {"name": "{{ name }}" } }'
NOTE: (2020/02/21) Verdaccio v4.4.2 does not support environment variables in config.yml
.
Please correct {OWNER}
and {GITHUB_TOKEN}
to the correct values.
NOTE: (2020/02/21) DO NOT use OpenUPM as a uplink registry.
For details, see https://github.com/openupm/openupm/issues/68.
Settings
.
Secrets
.Name
input box.Add secret
.Variable | Description |
---|---|
GH_TOKEN |
Required. The token created via GitHub personal access token. |
NPM_TOKEN |
Npm token created via npm token create |
If you do not need GitHub Actions, you can remove .github/workflows/update.yml
.
To update searchable packages manually, execute the following commands:
export GH_TOKEM=*********
export NPM_TOKEM=********* # optional
npm ci
npm run update -- --no-ci
NOTE: Execute these commands each time a new package is added to your package registry.
.github/workflows/update.yml
.config.yml
.{OWNER}
and {GITHUB_TOKEN}
to the correct values.This is an open-source project that I am developing in my free time.
If you like it, you can support me.
By supporting, you let me spend more time working on better tools that you can use for free. :)