Unity Build Factory is a workflow for building and deploying multi-architecture Unity projects using GitHub Actions and GameCI. It was created to unify the repetitive build process for multiple projects and simplify deploying to GitHub Pages for private repositories with build artifacts that can be download by unauthenticated visitors.
By default the workflow will compile and build the Unity project for the following platforms:
- Windows
- Linux
- WebGL
- console support coming
It is capable of deploying the build artifacts to the following platforms:
- GitHub Pages
- steam support coming
I'm currently using Unity Build Factory to rapidly deploy demos for a few of my projects, like Neebo.
- Have a GitHub repository containing a Unity project.
- Fork this repository and enable Actions.
- Create a GitHub Personal Access Token with read/write access to the target Unity project repository.
- Review GameCI and add the following GitHub repository secrets to your fork:
UNITY_EMAIL
UNITY_PASSWORD
UNITY_LICENSE
PAT_TOKEN
- In your fork, find the Actions workflow named
project builder
and selectRun workflow
- enter the
owner/repo
corresponding to the target Unity project repository - (optional) enter the
ref
or leave blank to use the repository's default branch - (optional) toggle
deploy-to-pages
and set thepages-deploy-branch
- run the workflow
- enter the
Each project will likely take a long time to finish building on the first run but caching will speed up subsequent runs.
Be wary of GitHub Actions billing, as the Unity Build Factory workflow can consume a lot of minutes and Artifact storage space if you have a lot of projects or are building frequently.
The workflow will create a pre-release for each platform and attach the corresponding build that was produced in Actions. The pre-releases are updated with each run as to not clutter the repository with tags while testing and deploying numerous builds.
To download the built artifacts simply navigate to the releases section of the target repository and download the artifacts from the pre-release that corresponds to the platform you want to download.
To enable support for deploying to GitHub Pages, the following steps are required:
- Enable
repo:write
access for the GitHub Personal Access Token used by the workflow. - Set
Compression Format
toBrotli
in the Unity project's WebGL deploy settings. - Enable GitHub Pages for the target repository.
- Add the following workflow to the target repository:
deploy-pages.yml
name: deploy project to gh-pages
on:
push:
branches:
- 'gh-pages'
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: deploy
cancel-in-progress: true
jobs:
deploy:
needs: read
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: configure pages
uses: actions/configure-pages@v2
- name: upload pages build artifact
uses: actions/upload-pages-artifact@v1
with:
path: .
- name: deploy pages
id: deployment
uses: actions/deploy-pages@v1
-
Add a WebGL build demo template to the target repository under the directory
WebGL
.A WebGL template in this context refers to a directory following the structure produced by Unity when running a WebGL build, the build factory will replace the template's game contents with what your project produces and keep the rest of the WebGL template as-is, allowing you to create a custom-tailored static site that hosts your game's WebGL build.
Open an issue: https://github.com/plyr4/unity-factory/issues