A simple free template CI/CD system using GameCI for Unity games using GitHub Actions.
You can check out the sample app on the Releases tab of this GitHub repo.
- GitHub Releases
- Builds get submitted to the "Releases" tab of your repo as a new release with separate .zip files for each build.
- Last Commit SHA is added to the project via a .json file.
\Assets\Data\data.jsonin the project which can be displayed in game (on a main menu or something if you want).- Showcased in the Unity project scene.
- Version number is updated to Unity's player and can be accessed using
Application.version. - Project name is updated to Unity's player and can be accessed using
Application.productName. - Unity Build Profiles
- Under the
buildForAllSupportedPlatformsjob, you can change thestrategy'smatrixand include whatever build profiles you want - Showcased in the differences between the built Unity projects, including the defines included in the Build Profiles as displayed in the Unity project scene.
- Under the
- Supports semantic versioning (MAJOR.MINOR.PATCH).
- Every push increments the PATCH number, with MAJOR and MINOR being incremented maually.
- (Optional) Parallel builds (to speed up development, but may need to be turned off if memory is exceeding what your runner supports).
- Under the
buildForAllSupportedPlatformsjob, you can change thestrategy'smax-parallelvalue accordingly.
- Under the
- (Optional) Fail fast support, so you're not creating multiple builds if one fails.
- Under the
buildForAllSupportedPlatformsjob, you can change thestrategy'sfail-fastaccordingly. - It's set as
falseby default because sometimes there could be a problem with a single build profile or platform -- but it's there if you're stingy with your runner minutes.
- Under the
- (Optional) LFS support
- Under the
Checkout repositorystep, change thelfsvalue accordingly.
- Under the
- (Optional) Concurrent workflows
- Under
concurrency, set thecancel-in-progressvalue accordingly. - This is mostly to save on runner minutes, but if you don't care about that, leaving it
falseallows you to better track down a bug, especially when collaborating with multiple devs or if you have long build times.
- Under
Every time a push is made to the GitHub repository, builds will trigger using the Unity BuildProfiles files provided in the build.yml. This will also increment the PATCH version number. A Release Tag will be generated and the builds generated will be included in your repo page's "Releases" tab.
Build profiles included by default:
windows-dev: Dev build for Windows with DEV defines includedwindows-rel: Release build for Windows with REL defines includedlinux-dev: Dev build for Linux with DEV defines includedlinux-rel: Release build for Linux with REL defines includedwebgl-dev: Dev build for WebGL with DEV defines includedwebgl-rel: Release build for WebGL with REL defines included
Used to manually version bump the version number. Should be in the format X.Y.Z. All future pushes will subsequently start incrementing based on the new MAJOR or MINOR version changes.
- Ex: If the last version before triggering this workflow is v0.0.42, and the workflow was triggered with v0.1.0, the next build.yml workflow run will create the version tag v0.1.1.
- Fork/clone this repository (rename repository to match your project)
- "Use this template" > "Create a new repository" > etc.
- Or if you already have a project: Copy the workflows located in this repo's
.github/workflows/into your.github/workflows/(create this directory if you don't have one already.github/workflows/build.yml.github/workflows/version-bump.yml
- Rename your Unity project name to whatever you want
unity_project/->MyAmazingUnityGame/
- Find/Generate Unity license
- Open Unity Hub and log in with your Unity account (if you do not have a current .ulf) then navigate to Preferences > Licenses > Add)
- Find your
Unity_lic.ulffile- Windows:
C:\ProgramData\Unity\Unity_lic.ulf - Mac:
/Library/Application Support/Unity/Unity_lic.ulf - Linux:
~/.local/share/unity3d/Unity/Unity_lic.ulf
- Windows:
- Hook up Unity Credentials
- On your GitHub repo's, navigate to Setting > Secrets and variables > Actions
- Create three new Repository secrets
UNITY_LICENSE(Paste the contents of your license file into here)UNITY_EMAIL(Add the email address that you use to log into Unity)UNITY_PASSWORD(Add the password that you use to log into Unity)
- In
.github/workflows/build.yml, in theenv, set the following variables:PROJECT_NAME(line 18) variable to your project's nameUNITY_VERSION(line 19) variable to your project's Unity version- Ensure it uses a version of Unity that GameCI supports on their tags page
PROJECT_PATH(line 20) variable to your project's path
- In
.github/workflows/build.yml, in theon, set which branches you want to trigger builds from onpushand onpull_request - In
.github/workflows/build.ymlin thebuildForAllSupportedPlatformsjob, in thestrategymatrixconfig, include the Unity Build Profiles you want generated
No plans on when I'd release these features, would likely depend on my needs for a specific project/boredom/random interest in moving this project along.
- Include multiple workflow concurrency
- Include platform and included defines in .json
- Android build support
- iOS build support
- VR build support
- itch.io CD
- Steam CD
- Epic Games CD
- Slack notifications webhook
- Google Meets notifications webhook
- Discord notifications webhook
- Microsoft Teams notifications webhook
- Add more concurrency features for multiple in progress workflows