Unity_GitHubActionsAndPages: Project showing the Unity + GitHub Actions build and deploy to GitHub Pages
A sample Unity project demonstrating how to build and deploy a WebGL build using GitHub Actions and host it via GitHub Pages.
This project uses game.ci for Unity CI integration.
This project is created as an experiment to show the build and publish capabilities of GitHub actions for a Unity project. The workflow heavily relies on the use of game.ci and GitHub Actions. The final project will be published on GitHub Pages
Each time a new PullRequest is merged into master the build-and-deploy-WebGL workflow will trigger, building and publishing the Unity project for WebGL.
The build artifact is then pushed to the WebGLBuild branch. Which in turn is used as a source for GitHub pages.
Play the project here.
- 🔄 CI/CD – Fully automated build and deploy workflow with GitHub Actions.
- 🌐 WebGL Output – Hosted on GitHub Pages for easy sharing.
- 🧱 Unity Sandbox – Move 0-friction blocks around with
WASDin a minimal Unity scene.
If you would like to apply this simple workflow to your Unity project, follow these steps:
GitHub Pages does not support Brotli or gzip compression natively.
- Open your Unity project
- Go to
Edit > Project Settings > Player > Publishing Settings - Set Compression Format to
Disabled
This branch will host your compiled WebGL build.
git checkout -b WebGLBuild
git push origin WebGLBuild- Go to your repository on GitHub
- Navigate to
Settings > Pages - Under Branch, choose
WebGLBuild, and set the folder to/ (root) - Save your changes
- Go to: ./.github/workflows/
- Copy the contents of
build-and-deploy-WebGL.yml - In your GitHub project:
- Open the
Actionstab - Press
New workflow - Choose
Skip this and set up a workflow yourself - Paste the contents of the
build-and-deploy-WebGL.yml
- Open the
- Update the file
Line 30 & 44: Point to your Unity project folderLine 61 & 85: ChangeWebGLBuildwith your build branch nameLine 85: ChangeFlorisDeVries/Unity_GitHubActionsAndPagesto your repository name
- Rename the workflow and press
Commit changes...
- Create a new token: Personal Access Tokens
- Select
Only select repositories, then select your project repository - Add minimally required
Repository permissionsto Access Token:Contents=> Read and writeMetadata=> Read-only
- Copy and save your token securely
- Add it to your repo
- GoTo
Settings > Secrets and variables > Actions - Create a New repository secret
- Name:
ACTIONS_PAT - Value: Token value
- Name:
- GoTo
You’ll need your Unity license for CI builds:
- Open Unity Hub
- Go to
Preferences > Licenses - Click
Add→ Choose license type (e.g., Personal)
-
Locate your license file:
- Windows:
C:\ProgramData\Unity\Unity_lic.ulf - Mac:
/Library/Application Support/Unity/Unity_lic.ulf - Linux:
~/.local/share/unity3d/Unity/Unity_lic.ulf
- Windows:
-
Add the following secrets to your GitHub repo:
UNITY_EMAIL: your Unity account emailUNITY_PASSWORD: your Unity passwordNOTE: If you use SSO sign-in (e.g. Apple, Google, Facebook or other), go to Unity Cloud → Security and create a specific password.
UNITY_LICENSE: contents of the.ulflicense file
Push to the main branch to trigger the workflow.
Or, add this to your workflow YAML to enable manual triggering:
on:
push:
branches: [ main ]
workflow_dispatch:Here are some helpful links and references related to this project:
-
🎮 Unity
-
🤖 CI/CD & Automation
-
🔐 Authentication & Security
-
💡 Related Projects & Examples
-
🛡️ Badges


