Skip to content

Build Unity Artifact #100

Build Unity Artifact

Build Unity Artifact #100

name: Build Unity Artifact
on:
#push:
#pull_request:
workflow_dispatch:
inputs:
target_platform:
description: 'target build platform'
required: true
default: 'WebGL'
jobs:
build:
name: Build for ${{ matrix.targetPlatform }}
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
targetPlatform:
- "${{github.event.inputs.target_platform}}"
steps:
# Install deps
- name: Ensure git lfs
run: sudo apt-get install git-lfs
shell: bash
# Fix permissions
- name: Ensure proper file permissions
run: |
ls -hal
sudo chown $USER:$USER -R ../unity-webgl-nginx
shell: bash
# Checkout
- name: Checkout repository
uses: actions/checkout@v3
with:
lfs: true
# Cache
- uses: actions/cache@v2
with:
path: Library
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
restore-keys: |
Library-
# Test
#- name: Run tests
# uses: game-ci/unity-test-runner@v2
# env:
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
# with:
# githubToken: ${{ secrets.GITHUB_TOKEN }}
# Build Unity Project
# Can fail silently if activation file is invalid which will result
# in a completed jib but an empty artifact directory
- name: Build project
uses: cloudymax/unity-builder@nvidia-gpu-support
env:
DISPLAY: |
:0
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
VNC_ENABLED: true
RECORD_SCREEN: true
with:
targetPlatform: ${{ matrix.targetPlatform }}
nvidiaGpus: "all"
# Upload artifact to storage
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}