Skip to content

Instantly share code, notes, and snippets.

@morphingcoffee
Created January 16, 2022 17:05
Show Gist options
  • Save morphingcoffee/e35661fa96c3e2c707de02530882ef93 to your computer and use it in GitHub Desktop.
Save morphingcoffee/e35661fa96c3e2c707de02530882ef93 to your computer and use it in GitHub Desktop.
Unity game build, archive and deployment to itch.io automation (Windows, Linux, MacOS)
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 }}
name: Build all platforms
on:
# Enable manual trigger
workflow_dispatch:
inputs:
itch_deployment:
description: 'Deploy to itch.io (y/n)'
default: n
itch_suffix:
description: '(Optional) itch.io channel suffix'
default: dev
jobs:
buildMultiPlatform:
name: Build ${{ matrix.targetMetadata[0] }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# [ Unity Target ID, itch.io channel base name ]
targetMetadata:
- [ StandaloneOSX, osx ] # Build a macOS standalone (Intel 64-bit).
- [ StandaloneWindows64, win ] # Build a Windows 64-bit standalone.
- [ StandaloneLinux64, linux ] # Build a Linux 64-bit standalone.
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v2
with:
lfs: true
# Cache Unity generated files
- name: Cache Unity Generated files
id: cache-unity-library
uses: actions/cache@v2
with:
path: Library
key: Library-${{ matrix.targetMetadata[0] }}
restore-keys: |
Library-
# Build
- name: Build project
uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
with:
targetPlatform: ${{ matrix.targetMetadata[0] }}
allowDirtyBuild: true
# Store Outputs
# - name: Store Build
# uses: actions/upload-artifact@v2
# with:
# name: MyCustomGameName-${{ matrix.targetMetadata[0] }}-${{ github.run_id }}-${{ github.sha }}
# path: build/${{ matrix.targetMetadata[0] }}/*
# retention-days: 5
# Upload to itch.io using butler
- name: Butler Push to itch.io
if: ${{ github.event.inputs.itch_deployment == 'y' }}
uses: josephbmanley/butler-publish-itchio-action@v1.0.2
env:
BUTLER_CREDENTIALS: ${{ secrets.BUTLER_CREDENTIALS }}
CHANNEL: ${{ matrix.targetMetadata[1] }}-${{ github.event.inputs.itch_suffix }} # e.g. osx-dev
ITCH_GAME: REPLACE_WITH_YOUR_OWN
ITCH_USER: REPLACE_WITH_YOUR_OWN
PACKAGE: build/${{ matrix.targetMetadata[0] }}/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment