Skip to content
 
 

Latest commit

 

History

36 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unity 6 CI/CD Boilerplate with GitHub Actions

A Unity 6000.x project that teaches you proper CI/CD on GitHub:

  • Build once. On every push and pull request, the project builds for WebGL on a GitHub-hosted runner using GameCI.
  • Deploy from artifact. On pushes to the default branch, the build is published to GitHub Pages straight from the workflow artifact with GitHub's official deploy-pages action. No gh-pages branch is pushed and the workflow never needs write access to your code — each job only gets the permissions it declares.

WebGL published here (EDIT IT!): https://YOUR_GH_USERNAME.github.io/YOUR_REPO_NAME/

Setup Steps:

The pipeline:

Read .github/workflows/main.yml — it is heavily commented and is the main teaching artifact of this repository. It runs two jobs in order:

  1. build — game-ci/unity-builder@v4 builds WebGL. The build is uploaded as an artifact named Build-WebGL that you can download from any run page.
  2. deploy — only runs on pushes to main/master. It downloads the Build-WebGL artifact and hands it to actions/deploy-pages@v4. GitHub Pages pulls the site from the artifact, so the job needs only pages: write + id-token: write permissions — nothing can push to your branches.

The Unity version is pinned by ProjectSettings/ProjectVersion.txt. GameCI reads it (unityVersion: auto) and picks the matching Docker image, so the local editor and CI always agree. To upgrade Unity, change the version locally and CI follows on the next push.

  • I have read the .github/workflows/main.yml file and understand how the two jobs connect (needs:) into a pipeline;
  • I understand that the deploy job has if: conditions limiting it to pushes on the default branch;
  • I understand that pull requests run builds but never deploy;

Workflow habits:

Smart Merge (optional but recommended):

.gitattributes asks git to use Unity's Smart Merge (UnityYAMLMerge) for .unity, .prefab, .asset and .mat files so scene and prefab merges produce valid YAML instead of broken files. It needs a one-time local setup — run once per machine:

git config merge.unityyamlmerge.name "Unity SmartMerge"
git config merge.unityyamlmerge.driver "<UNITY_INSTALL_PATH>/Editor/Data/Tools/UnityYAMLMerge merge -h -p --force --fallback none %O %A %B %P"

Replace <UNITY_INSTALL_PATH> with your editor install location (e.g. /Applications/Unity/Hub/Editor/6000.6.2f1/Unity.app/Contents on macOS or C:\Program Files\Unity\Hub\Editor\6000.6.2f1 on Windows). See https://docs.unity3d.com/Manual/SmartMerge.html

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages