Skip to content

CI CD Workflows

Ethan edited this page Sep 27, 2025 · 4 revisions

A successful "Export Unity Package" step showing the .unitypackage file created.

CI/CD Workflows

This page explains the Continuous Integration / Continuous Deployment (CI/CD) setup used in this template to build and export Unity packages automatically.


🎯 Purpose

The CI/CD workflow automates:

  1. License validation – Ensures the Unity license is valid and not expired before building.
  2. Automated package building – Uses game-ci/unity-builder with the built-in Exporter.ExportPackage method.
  3. Artifact storage – Makes the built package available for download in the workflow artifacts.

πŸ“‚ Workflow File

The workflow is defined in:

.github/workflows/package-builder.yml

βš™οΈ Trigger Conditions

The workflow runs:

  • Automatically on push to:
    • main branch
    • Any branch starting with experimental/
  • Manually via the Run workflow button in the GitHub Actions tab.

πŸ”‘ Required Secrets

Before running, the repository must have these secrets set in Settings β†’ Secrets and variables β†’ Actions:

Secret Description
UNITY_LICENSE Unity license file (ULF) contents.
UNITY_EMAIL Unity account email.
UNITY_PASSWORD Unity account password.

⚠ Important:

  • Keep these secrets up to date.
  • The license expiration date is currently set in stopDate inside the workflow file.
  • If you are unsure about what values to use or how to obtain them, contact: @PharaEthan | Lead Developer | ethan.hernou@gmail.com

πŸ“œ Workflow Stages

1️⃣ License Check

  • Runs on: ubuntu-latest
  • Purpose:
    • Fails the workflow if the Unity license is missing.
    • Compares the current date to the stopDate variable to ensure it has not expired.

2️⃣ Package Export

  • Runs on: windows-latest
  • Uses: game-ci/unity-builder
  • Build Method: Exporter.ExportPackage (defined inside the Unity project).
  • Script Location: <package-name>/Assets/Editor/Exporter.cs
  • Export rules:
    • Includes Scripts/, Resources/, Editor/, Demo/.
    • Excludes Tests/ folders automatically.
  • Target Platform: StandaloneWindows64 (can be extended for other platforms).
  • Output: .unitypackage file stored inside:
template-package/ExportedPackages/

3️⃣ Artifact Upload

  • Uses actions/upload-artifact to store the built .unitypackage as a downloadable file from the GitHub Actions run page.

Result: A successful "Export Unity Package" step showing the .unitypackage file created.


πŸ›  Customization

  • Unity version β†’ Change unityVersion in the workflow file.
  • Docker image β†’ Update dockerImage to match your Unity version (source: docker unity-ci).
  • Project path β†’ Change projectPath to your Unity project folder (automatically changed when using rename.ps1 renaming project script).
  • Package export rules β†’ Adjust the Exporter.cs script if you want to include/exclude more folders.
  • License expiration β†’ Update stopDate after renewing your Unity license.

πŸ“₯ How to Download the Package

  1. Go to the Actions tab in the repository.
  2. Select the latest successful run of Export Unity Package.
  3. Scroll to the Artifacts section.
  4. Click UnityPackage to download the .unitypackage.

"Artifacts" section in the Actions run page.


πŸ“Œ Notes

  • If the license expires, the build will fail until the UNITY_LICENSE secret is updated.
  • Always keep the Unity version aligned with OMGG’s development environment.
  • If you add more platforms, update the matrix section in exportPackage.
  • If you add more folders, make sure to reflect them in Exporter.cs so they are properly included/excluded.

πŸ“ž Need Help?

If you encounter any issues with this GitHub Action, do not hesitate to contact:

Clone this wiki locally