75 lines
2.1 KiB
YAML
75 lines
2.1 KiB
YAML
name: Build project
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
buildForAllSupportedPlatforms:
|
|
name: Build for ${{ matrix.targetPlatform }}
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
targetPlatform:
|
|
- StandaloneWindows64 # Windows 64-bit standalone
|
|
- StandaloneLinux64 # Linux 64-bit standalone
|
|
unityVersion:
|
|
- 6000.0.37f1 # Stable Unity LTS version (update if needed)
|
|
|
|
steps:
|
|
- name: Update APT and Install Dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y curl git-lfs
|
|
git lfs install
|
|
|
|
- name: Install Node.js
|
|
run: |
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
|
|
sudo apt-get install -y nodejs
|
|
node -v
|
|
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
lfs: true
|
|
|
|
- name: Add Current User to Docker Group
|
|
run: |
|
|
sudo usermod -aG docker $(whoami)
|
|
sudo systemctl restart docker
|
|
|
|
|
|
- name: Cache Unity Library (Speeds up builds)
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: Library
|
|
key: Library-${{ matrix.targetPlatform }}
|
|
restore-keys: Library-
|
|
|
|
- name: Ensure Entrypoint Exists & is Executable
|
|
run: |
|
|
if [ -f "/entrypoint.sh" ]; then
|
|
echo "Entrypoint found!"
|
|
chmod +x /entrypoint.sh
|
|
else
|
|
echo "Entrypoint script missing! Build may fail."
|
|
fi
|
|
|
|
- name: Build with Unity
|
|
uses: game-ci/unity-builder@v4
|
|
env:
|
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
with:
|
|
targetPlatform: ${{ matrix.targetPlatform }}
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
runAsHostUser: false # Fixes self-hosted permission issues
|
|
|
|
- name: Upload Build Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: Build-${{ matrix.targetPlatform }}
|
|
path: build/${{ matrix.targetPlatform }}
|