Javascript required
Skip to content Skip to sidebar Skip to footer

Unity Game Not Uploading Right to Itch

Creating a free build pipeline for Unity games using GitHub Deportment

crawling.io logo

Over the by year of quarantine, I've been participating in game jams, and I'yard unremarkably the person responsible for creating and uploading builds to crawling.io for the team to test. Aside from existence a tedious task, this process blocks less technical members of my team from seeing their work run in-browser until I take time to upload a new build. Then, in betwixt jams, I whipped upwardly a quick fashion to automate this process using GitHub Actions and Unity build actions from game.ci/ so that changes can flow smoothly from commit to build to itch.io without any demand for me to intervene.

Before yous begin this tutorial, you should take Unity Project that is in a GitHub repository that you accept admin rights to, every bit well as a Unity account and an itch.io account(if you don't have whatsoever of those, set them up and come back to this guide after)

Step i — Set up your itch.io page (if you oasis't already)

Get to https://itch.io/game/new and create a new project (don't worry nearly uploading anything right now — you'll get to that later).

Notation the name of the page that you create (you'll demand it for afterwards).

Step 2 — Grab your crawling.io API Primal

Hop on over to https://crawling.io/user/settings/api-keys, click "Generate new API Key", and copy the central it generates.

On your repository page navigate to Settings -> Secrets->New Repository Secret

Name the hole-and-corner BUTLER_CREDENTIALS, paste in the API key underneath, and click "Add Secret"

Step 3a (if you lot're using the gratis version of Unity)— Go your activation file

For the free version of Unity you'll need a license file to tie the builds to a Unity Account.

Create a new file named activation.yml in your repository in under .github/workflows and paste in the following code (make sure to replace 2020.3.4f1 with the version of Unity you're using).

          proper noun: Acquire activation file
on:
workflow_dispatch: {}
jobs:
activation:
name: Asking transmission activation file 🔑
runs-on: ubuntu-latest
steps:
# Request manual activation file
- proper noun: Request manual activation file
id: getManualLicenseFile
uses: game-ci/unity-request-activation-file@v2
with:
unityVersion: 2020.3.4f1
# Upload artifact (Unity_v20XX.X.XXXX.alf)
- proper name: Betrayal equally artifact
uses: actions/upload-antiquity@v2
with:
proper name: ${{ steps.getManualLicenseFile.outputs.filePath }}
path: ${{ steps.getManualLicenseFile.outputs.filePath }}

Commit and button this file to your GitHub repository, then navigate to Actions and click on "Acquire activation file" nether Workflows and click "Run workflow".

Refresh the folio and click on the about recent workflow run, "Larn activation file" (there should be a xanthous or green circle adjacent to it), and expect for the workflow to complete.

Once the workflow is finished, click on the .alf file under Artifacts to download information technology (you may have to unzip it afterwards).

Go to https://license.unity3d.com/manual and upload the .alf file (you may have to login first). Follow all the steps unitl you become to a button that says "Download license file". Click on this button and save the file somewhere you'll call back.

One time y'all accept that file downloaded, open the contents in a text editor and copy the text. Go back to Settings -> Secrets->New Repository Secret in GitHub and add a new undercover named UNITY_LICENSE with the contents of the file as the value.

Footstep 3b (If you're using Pro/Plus version of unity) — Add your serial fundamental

Navigate to Settings -> Secrets->New Repository Secret in GitHub and create the post-obit secrets:

  • UNITY_SERIAL - The serial cardinal from your unity account that looks like XX-XXXX-XXXX-XXXX-XXXX-XXXX
  • UNITY_EMAIL - The e-mail address that y'all use to login to Unity
  • UNITY_PASSWORD - The password that you employ to login to Unity

Pace four — Gear up your Unity Build Workflow

Now we tin become down to business!

Create a new file named main.yml in your repository in under .github/workflows and paste in the following code:

          proper noun: Build Projection and Publish to crawling.io
on: [push]
jobs:
build:
name: Build Projection and Publish to itch.io ✨
runs-on: ubuntu-latest
# This stops builds that are in-progress once a new commit comes in
concurrency:
group: unity-build
cancel-in-progress: true
steps:
# Checkout
- name: Checkout repository
uses: deportment/checkout@v2
with:
lfs: truthful
# Cache
- uses: deportment/cache@v2
with:
path: Library
primal: Library
# Build
- proper name: Build project
uses: game-ci/unity-builder@v2
env:
# Annotate this out if you're using a pro license
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
# Un-Comment the post-obit lines if yous're using a pro license
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
# UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
targetPlatform: WebGL
# Return License (United nations-Comment if you're using a pro license)
#- proper noun: Return license
# uses: game-ci/unity-return-license@v1
# if: ever()
# Output
- uses: deportment/upload-artifact@v2
with:
name: Build
path: build

If you desire to build for a different platform supplant WebGL with your build target.

Afterward committing and pushing, a new workflow run will appear in the Deportment tab of your GitHub page.

Once the workflow run completes you lot should meet Success and a Build.zilch file under artifacts. Download information technology and make sure that it'due south working correctly.

If the run didn't succeed, check the logs of the workflow run and review the steps you've taken then far. If none of that helps, consult the documentation for game-ci.

Step 5— Set upwards automatic publish to crawling.io

At present that you've got a remote build of your project working information technology'south fourth dimension to publish it to itch.io.

Open master.yml once again and supersede the Output stride with the code below:

                      # Upload to Itch
- uses: josephbmanley/butler-publish-itchio-activity@chief
env:
BUTLER_CREDENTIALS: ${{ secrets.BUTLER_CREDENTIALS }}
Aqueduct: html5
ITCH_GAME: <Game proper name goes here (it should be the end of your url)>
ITCH_USER: <Username goes here>
Packet: build/WebGL

Replace annihilation in <> with the appropriate values. If you want to publish a binary replace html5 with win, linux, or mac and replace WebGL with your build target.

After committing and pushing, you should run across a new workflow run. Look for it to terminate.

Hop on over to your Edit Project page on crawling.io and you should see your build published. If you're creating an HTML5 build like I did, brand sure to cheque "This file volition be played in browser".

You lot're washed!

Some important things to know about your new set-up:

  • If you are using this on a private repository, you will be limited to 2000 minutes of workflow time per month. This can rack up quickly if build times for your projection are long and then exist mindful of information technology. You can also buy more time if yous demand it.
  • You are also limited to 500 MB of artifact storage. This shouldn't exist a problem as long every bit you removed the Output footstep from chief.yml.
  • Every commit that is pushed will automatically be published. Make sure your team knows this. If you need more validation look into https://game.ci/docs/github/test-runner.

greenhalghtedy1974.blogspot.com

Source: https://medium.com/@jaidengerig/create-a-cd-pipeline-to-auto-publish-unity-games-from-github-to-itch-io-in-30-minutes-for-free-bae3b254283c