How to Publish a Unity Package
Prerequisites
- An organization on pckgs.io. See Create an Organization.
- A Unity package with a valid
package.jsonat its root.
Upload via Web Interface
Navigate to your organization’s page and click Upload Package in the Packages section.
Select your package folder:
Click the selector and choose the folder that contains your package’s package.json.
A confirmation dialog will appear, click Yes to proceed.
Review the detected package metadata and click Upload.
After a successful upload you’ll be redirected to the package page.
Upload via npm cli
The Unity registry is npm-compatible, so you can publish packages with the standard npm publish command instead of the web interface.
Prerequisites
- A pckgs.io access token with write access to the organization. See Create an Access Token.
Publish
Run this from the directory containing your package’s package.json:
npm publish --registry=https://unity.pckgs.io/<YOUR_ORG_NAME> --//unity.pckgs.io/:_authToken=<YOUR_ACCESS_TOKEN> Replace <YOUR_ORG_NAME> with your organization’s slug and <YOUR_ACCESS_TOKEN> with the token you created.
Persist credentials (optional)
To avoid passing the registry and token on every publish, add them to an .npmrc file at your package root instead:
registry=https://unity.pckgs.io/<YOUR_ORG_NAME>
//unity.pckgs.io/:_authToken=<YOUR_ACCESS_TOKEN> Then publish with just:
npm publish Upload via GitHub Actions
Automate publishing on every push using the pckgs-io/upload-unity-package@v1 action.
Prerequisites
- A pckgs.io access token stored as a repository secret named
PCKGS_ACCESS_TOKEN. See Create an Access Token.
Example Workflow
name: Upload Unity Package to pckgs.io
on:
push:
branches: [main]
jobs:
upload:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Upload package to pckgs.io
uses: pckgs-io/upload-unity-package@v1
with:
organization: myorgname
package_folder: Assets/Package
access_token: ${{ secrets.PCKGS_ACCESS_TOKEN }}
is_public: false
version: "1.0.${{ github.run_number }}"
contributor_email: ${{ github.event.pusher.email }}
contributor_name: ${{ github.event.pusher.name }}
contributor_url: https://github.com/${{ github.actor }} Action Parameters
| Parameter | Required | Description |
|---|---|---|
organization | No | Organization slug on pckgs.io. If omitted, it’s extracted from the second segment of the package name (e.g. com.myorg.package becomes myorg) |
package_folder | No | Relative path to the package folder containing package.json. Defaults to the repository root if omitted |
access_token | Yes | pckgs.io access token for authentication |
is_public | Yes | true or false, applies only on first upload |
version | No | Overrides the version in package.json |
contributor_email | No | Email of the contributor |
contributor_name | No | Name of the contributor |
contributor_url | No | URL to the contributor’s profile |
Related
- Unity Package Registry Authentication
- How to Install a Unity Package
- How to Import a Unity Package
- Create an Access Token
Need help? Contact us here or at [email protected].