I recently transitioned from being a full time game developer to being a tech lead working mostly on full-stack applications. One of the things I noticed is how fast and agile deployments are for websites made with modern technology. Creating pipelines with Jenkins and GitHub actions was eye-opening as a developer whos "pipeline" consisted of building for different platforms, zipping up each build folder and dragging that zip file into Steam's backend before pressing publish.

This semi-manual workflow usually took me around one hour to deploy my games, Nonno Lorenzo and Leaf .

A few months ago I stumbled upon a collection of GitHub-actions called GameCI that builds your game for you, leaving you with time to focus on actually developing your game instead of waiting for Unity to compile.

Adding this to my workflow was pretty straight forward.

Setting up GameCI

The first step is to set up your project on GitHub. While doing this it is important to choose the "unity" gitignore template and to set up LFS if you have large files.

The second step is to create a new Unity lisence using the GameCI activation action.

name: Acquire activation file on: workflow_dispatch: {} jobs: activation: name: Request manual activation file 🔑 runs-on: ubuntu-latest steps: # Request manual activation file - name: Request manual activation file id: getManualLicenseFile uses: game-ci/unity-request-activation-file@v2 # Upload artifact (Unity_v20XX.X.XXXX.alf) - name: Expose as artifact uses: actions/upload-artifact@v2 with: name: ${{ steps.getManualLicenseFile.outputs.filePath }} path: ${{ steps.getManualLicenseFile.outputs.filePath }}

Run this though the "actions" section in your GitHub repo and wait for it to generate a .alf file.

Upload your file to license.unity3d.com to create a new license and choose your desired license type. Download the .ulf file this generates.

Create a new secret in your GitHub repository named "UNITY_LICENSE" and add the contents of this file to the secret.

The final part is to create the GitHub action that actually builds your game using the license your created above.

name: Build project on: push: tags: - '*' jobs: buildForAllSupportedPlatforms: name: Build for ${{ matrix.targetPlatform }} runs-on: ubuntu-latest strategy: fail-fast: false matrix: targetPlatform: - StandaloneWindows64 # Build a Windows 64-bit standalone. - StandaloneOSX # Builds a mac standalone. steps: - uses: actions/checkout@v2 with: fetch-depth: 0 lfs: true - uses: actions/cache@v2 with: path: Library key: Library-${{ matrix.targetPlatform }} restore-keys: Library- - uses: game-ci/unity-builder@v2 env: UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }} with: targetPlatform: ${{ matrix.targetPlatform }} - uses: actions/upload-artifact@v3 with: name: Build-${{ matrix.targetPlatform }} path: build/${{ matrix.targetPlatform }} - uses: montudor/action-zip@v1 with: args: zip -qq -r build/${{ matrix.targetPlatform }}.zip build/${{ matrix.targetPlatform }} - uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.PROJECT_N_PAT }} asset_name: ${{ matrix.targetPlatform }}.zip file: build/${{ matrix.targetPlatform }}.zip tag: ${{ github.ref }} overwrite: true body: ${{ github.event.release.body }}

You can add more entries under the targetPlatform if you want to target more platforms.

To start a build, simply tag your commit and push. The first deploy will take longer because it has to cache to rely on.

When the build is done, it will create a new release under the tag name you gave your commit.

Image of a GameCI release

You can then download each platform release and play :) This configuration could also be hooked up to automatically upload this .zip file to an S3 bucket or straight to steam using Steam CLI.

More posts