unity-actions-example/.github/workflows/main.yml
2023-04-21 18:22:13 -05:00

136 lines
3.8 KiB
YAML

name: Unity Actions
on:
pull_request: {}
push: {}
workflow_dispatch: {}
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
PROJECT_PATH: .
jobs:
### See https://game.ci/docs/github/getting-started
activation:
if: ${{ env.UNITY_LICENSE == '' }}
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 }}
test:
if: ${{ env.UNITY_LICENSE != '' }}
name: Run all tests ✨
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/cache@v3
with:
path: ${{ env.projectPath }}/Library
key: Library-test
- uses: game-ci/unity-test-runner@v2
id: testRunner
with:
projectPath: ${{ env.PROJECT_PATH }}
githubToken: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/upload-artifact@v3
with:
name: Test results (all modes)
path: ${{ steps.testRunner.outputs.artifactsPath }}
build:
needs: [test]
name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
targetPlatform:
- StandaloneLinux64
- iOS
- Android
- WebGL
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/cache@v3
with:
path: ${{ env.projectPath }}/Library
key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2
with:
projectPath: ${{ env.PROJECT_PATH }}
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v3
with:
name: Build-${{ matrix.targetPlatform }}
path: ${{ env.PROJECT_PATH }}/build
buildWithMac:
needs: [build]
name: Build for ${{ matrix.targetPlatform }}
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
targetPlatform:
- StandaloneOSX
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/cache@v3
with:
path: ${{ matrix.projectPath }}/Library
key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2
with:
projectPath: ${{ env.PROJECT_PATH }}
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v3
with:
name: Build-${{ matrix.targetPlatform }}
path: ${{ env.PROJECT_PATH }}/build
buildWithWindows:
needs: [buildWithMac]
name: Build for ${{ matrix.targetPlatform }}
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
targetPlatform:
- StandaloneWindows
- StandaloneWindows64
- WSAPlayer
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/cache@v3
with:
path: ${{ env.projectPath }}/Library
key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2
with:
projectPath: ${{ env.PROJECT_PATH }}
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v3
with:
name: Build-${{ matrix.targetPlatform }}
path: ${{ env.PROJECT_PATH }}/build