Skip to content

Macawls/UnityDeployExample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Presentation


https://macawls.dev/UnityDeployExample/

Docs and Resources


Build, Test and Deploy 💻

Setting Up a Repository for Unity



An alternative is GitHub Desktop, which makes this process much easier and allows you to skip some steps.

Initialize the repository at the root of the project.

git init

Use a .gitignore file to tell git which files to ignore.
Here's a repo with a bunch of templates https://github.com/github/gitignore

wget https://raw.githubusercontent.com/Macawls/unitydeployexample/based/.gitignore -o ".gitignore"

Download Git LFS
Install LFS in your repository:

git lfs install

Use a .gitattributes file for LFS to tell it which files to track.

wget https://raw.githubusercontent.com/Macawls/unitydeployexample/based/.gitattributes -o ".gitattributes"

All done! Have a look at which files are going to be tracked using:

git status

Building and Deploying to Itch.IO with GitHub Actions


Testing

It's best practice to test your project before building your game to increase reliability and confidence in merging changes.

Unity License Setup


We need to tell Unity we're legit. Create a file at .github/workflows/activation.yml and push your changes. You'll only need to run this once.

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 }}

The workflow is meant to be run manually, defined by

on:
  workflow_dispatch: {}

Run the workflow under the actions tab and download the artifact once it's done.

Sign into Unity License with your credentials and upload the artifact.

You should now receive your license file (Unity_v20XX.x.ulf).

Head over to the settings tab of your Github repository.

Create the following Secrets under your repository settings

  • UNITY_LICENSE - (Contents of your downloaded license file)
  • UNITY_EMAIL - (Unity email address)
  • UNITY_PASSWORD - (Unity password)

Make sure this is step is completed before continuing.

Setting Up Itch.IO


Create a new Itch.Io Page.

Note the name of the game, for example at this url https://macawls.itch.io/deployexample the name would be "deployexample".

Create a new Itch.io API key here and store that value as a secret named "BUTLER_CREDENTIALS".

Building and Deploying


Create a file at .github/workflows/main.yml and copy the contents of this file.

Use the values from the previous step in the this section of the file.

# Publish to Itch.IO
- uses: manleydev/butler-publish-itchio-action@master
  env:
    BUTLER_CREDENTIALS: ${{ secrets.BUTLER_CREDENTIALS }}
    CHANNEL: ${{ matrix.targetPlatform }}
    ITCH_GAME: <Name of the Game>
    ITCH_USER: <Your Itch.Io Username>
    PACKAGE: build/${{ matrix.targetPlatform }}

Decide which platforms you'd like to publish to.

Only use the allowed platform names.

  buildForAllSupportedPlatforms:
    name: Build and Deploy for ${{ matrix.targetPlatform }}
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false # if one build fails, other platforms will still be built
      matrix:
        targetPlatform:
          - StandaloneWindows64
          - WebGL
          - StandaloneOSX #etc

All Done!

If you want to embed the WebGL build to your Itch.IO Page tick this checkbox. You'll only need to do this once because the build is tied to the WebGL channel in Itch.Io.

About

A Guide on Deploying Unity Games To Itch.io with GitHub Actions!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Languages