96 lines
3.2 KiB
YAML
96 lines
3.2 KiB
YAML
name: Build project
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
buildForAllSupportedPlatforms:
|
|
name: Build for ${{ matrix.targetPlatform }}
|
|
# runs-on: ubuntu-22.04-large
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
unityVersion:
|
|
- 6000.0.37f1
|
|
targetPlatform:
|
|
- StandaloneWindows64 # Windows 64-bit standalone
|
|
- StandaloneLinux64 # Linux 64-bit standalone
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
lfs: true
|
|
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: Library
|
|
key: Library-${{ hashFiles('Assets/**', 'Packages/**', 'ProjectSettings/**') }}
|
|
restore-keys: |
|
|
Library-
|
|
|
|
# - uses: https://github.com/game-ci/unity-test-runner@v4
|
|
# id: testRunner
|
|
# env:
|
|
# UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
# UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
# UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
# with:
|
|
# unityVersion: ${{ matrix.unityVersion }}
|
|
# githubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# - uses: actions/upload-artifact@v3
|
|
# if: always()
|
|
# with:
|
|
# name: Test results (all modes)
|
|
# path: ${{ steps.testRunner.outputs.artifactsPath }}
|
|
# - if: matrix.targetPlatform == 'Android'
|
|
# uses: jlumbroso/free-disk-space@v1.2.0
|
|
|
|
- uses: https://github.com/game-ci/unity-builder@v4
|
|
env:
|
|
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
|
|
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
|
|
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
|
|
DOCKER_DEFAULT_PLATFORM: linux/amd64
|
|
with:
|
|
runAsHostUser: true
|
|
unityVersion: ${{ matrix.unityVersion }}
|
|
targetPlatform: ${{ matrix.targetPlatform }}
|
|
# customParameters: '-myParameter myValue -myBoolean -ThirdParameter andItsValue'
|
|
|
|
- name: Zip build artifacts
|
|
run: |
|
|
mkdir -p /tmp/zipped_builds
|
|
if [ "${{ matrix.targetPlatform }}" == "StandaloneLinux64" ]; then
|
|
cd build/StandaloneLinux64
|
|
zip -r /tmp/zipped_builds/build_StandaloneLinux64.zip . -x "StandaloneLinux64_BackUpThisFolder_ButDontShipItWithYourGame/**"
|
|
cd ../..
|
|
else
|
|
zip -r /tmp/zipped_builds/build_${{ matrix.targetPlatform }}.zip build/${{ matrix.targetPlatform }}
|
|
fi
|
|
|
|
- name: Debug - List files in /tmp/zipped_builds
|
|
run: |
|
|
ls -R /tmp/zipped_builds
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.sha }}
|
|
release_name: Release ${{ github.sha }}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Upload Release Asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PACKAGE_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: /tmp/zipped_builds/build_${{ matrix.targetPlatform }}.zip
|
|
asset_name: build_${{ matrix.targetPlatform }}.zip
|
|
asset_content_type: application/zip |