Automate Personal License Activation in Unity CI

Following up the thread, My disappointing experience using Unity in a CI pipeline is also the biggest obstacle for me as well. Personal license (free version) of Unity will expire in a period of time depends on your region. The licensing system from Unity is partially contradict to the CI/CD concept since it will force the user to update their secret UNITY_LICENSE on their GitHub Actions. (Notice this does not apply to Plus/Pro users because they use a different licensing system!) 😖

Let’s go straigt forward to the problem, what should we do about it? And what can be improved by this situation? My approach is to automate the licesning task, but how? Long story short, I came up with a node package unity-license-activate that is originally created by Mizo Take. The package uses a package named Puppeteer, meaning we can control browser through normal JavaScript! That is awesome, the biggest issue has been resolved! 😁

Next step, we just have to update our secret UNITY_LICENSE through GitHub’s API! The tasks are simple, we only need two following GitHub actions.

We can use read-file-action to read the downloaded .ulf file into memory, then we can use that as a value for our actions-set-secrets. Make sure you have added a secret ACCESS_TOKEN to your repository environment. It’s needed for creating/updating your GitHub secret from the workflow!

The full workflow file can be accessed through here.

🔐 Two Factor Authentication (TFA)

unity-license-activate may not work since Unity would require you to enter a 6 digit verification code from your email. To get pass this, you would have to install unity-verify-code in your workflow and follow the steps here.