Build Unity Artifact #107
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: | |
- name: Set owner of working dir recurively (Linux) | |
if: ${{ inputs.build_platform == 'linux' }} | |
run: sudo chown -R $(whoami) . | |
# 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@v4 | |
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 }} |