Skip to content

Reusable Workflow: publish-upm-packages

Orchestrates the complete build, signing, and deployment pipeline for Unity Package Manager (UPM) packages across caller repositories

Workflow Path: Trickle-Charge/TrickleCharge-Infra/.github/workflows/publish-upm-packages.yml@main

Inputs

Input Description Required Default
package-path Directory path or search glob for UPM packages No Packages/*
ignore-packages Space or comma-separated package names or folders to skip No -
registry-url Target npm/Verdaccio registry URL No https://npm.tricklecharge.dev
node-version Node.js runtime version No 20

Secrets

Secret Description Required
UNITY_ORG_ID Unity Organization ID for UPM CLI signing Yes
UPM_SERVICE_ACCOUNT_KEY_ID Unity UPM Service Account Key ID Yes
UPM_SERVICE_ACCOUNT_KEY_SECRET Unity UPM Service Account Key Secret Yes
NODE_AUTH_TOKEN Authentication token for the private registry Yes

Workflow Pipeline Steps

When called by a downstream repository, this workflow executes four high-level stages:

  1. Checkout Code: Pulls the host repository's source code using actions/checkout@v4.
  2. Setup UPM Environment: Invokes setup-upm-env to install Node.js, install the Unity UPM CLI, and configure registry credentials in ~/.npmrc.
  3. Pack and Sign UPM Packages: Invokes upm-pack-and-sign to discover packages, skip ignored targets, check version status against Verdaccio, and generate signed .tgz artifacts in ./signed-dist.
  4. Publish Packages to Verdaccio: Invokes publish-verdaccio to deploy new artifacts to the target registry.

Example Usage

Create a workflow file (e.g., .github/workflows/publish.yml) in any consumer repository:

name: Publish Packages

on:
  push:
    branches:
      - main

jobs:
  publish:
    uses: Trickle-Charge/TrickleCharge-Infra/.github/workflows/publish-upm-packages.yml@main
    with:
      package-path: "Packages/*"
      ignore-packages: "com.tricklecharge.template"
    secrets:
      UNITY_ORG_ID: ${{ secrets.UNITY_ORG_ID }}
      UPM_SERVICE_ACCOUNT_KEY_ID: ${{ secrets.UPM_SERVICE_ACCOUNT_KEY_ID }}
      UPM_SERVICE_ACCOUNT_KEY_SECRET: ${{ secrets.UPM_SERVICE_ACCOUNT_KEY_SECRET }}
      NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}