How to Publish a Unity Package

Prerequisites

  • An organization on pckgs.io. See Create an Organization.
  • A Unity package with a valid package.json at its root.

Upload via Web Interface

  1. Navigate to your organization’s page and click Upload Package in the Packages section.

  2. Select your package folder:

Click the selector and choose the folder that contains your package’s package.json.

  1. A confirmation dialog will appear, click Yes to proceed.

  2. Review the detected package metadata and click Upload.

  3. 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

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

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

ParameterRequiredDescription
organizationNoOrganization 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_folderNoRelative path to the package folder containing package.json. Defaults to the repository root if omitted
access_tokenYespckgs.io access token for authentication
is_publicYestrue or false, applies only on first upload
versionNoOverrides the version in package.json
contributor_emailNoEmail of the contributor
contributor_nameNoName of the contributor
contributor_urlNoURL to the contributor’s profile

Related

Need help? Contact us here or at [email protected].