Refactor main workflow

This commit is contained in:
David Finol 2023-04-21 18:39:45 -05:00
parent 50a3b40614
commit 916f5c617c

View File

@ -12,9 +12,22 @@ env:
PROJECT_PATH: . PROJECT_PATH: .
jobs: jobs:
### See https://game.ci/docs/github/getting-started checklicense:
name: Check for UNITY_LICENSE in GitHub Secrets
runs-on: ubuntu-latest
outputs:
is_unity_license_set: ${{ steps.checklicense_job.outputs.is_unity_license_set }}
steps:
- name: Check whether unity activation requests should be done
id: checklicense_job
run: |
echo "Skip activation job: ${{ env.UNITY_LICENSE != '' }}"
export is_unity_license_set="${{ env.UNITY_LICENSE != '' }}"
echo "is_unity_license_set=$is_unity_license_set" >> $GITHUB_OUTPUT
activation: activation:
if: ${{ env.UNITY_LICENSE == '' }} needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'false'
name: Request manual activation file 🔑 name: Request manual activation file 🔑
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -30,7 +43,8 @@ jobs:
path: ${{ steps.getManualLicenseFile.outputs.filePath }} path: ${{ steps.getManualLicenseFile.outputs.filePath }}
test: test:
if: ${{ env.UNITY_LICENSE != '' }} needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'true'
name: Run all tests ✨ name: Run all tests ✨
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -39,7 +53,7 @@ jobs:
lfs: true lfs: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: ${{ env.projectPath }}/Library path: ${{ env.PROJECT_PATH }}/Library
key: Library-test key: Library-test
- uses: game-ci/unity-test-runner@v2 - uses: game-ci/unity-test-runner@v2
id: testRunner id: testRunner
@ -69,7 +83,7 @@ jobs:
lfs: true lfs: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: ${{ env.projectPath }}/Library path: ${{ env.PROJECT_PATH }}/Library
key: Library-${{ matrix.targetPlatform }} key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2 - uses: game-ci/unity-builder@v2
with: with:
@ -95,7 +109,7 @@ jobs:
lfs: true lfs: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: ${{ matrix.projectPath }}/Library path: ${{ env.PROJECT_PATH }}/Library
key: Library-${{ matrix.targetPlatform }} key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2 - uses: game-ci/unity-builder@v2
with: with:
@ -123,7 +137,7 @@ jobs:
lfs: true lfs: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: ${{ env.projectPath }}/Library path: ${{ env.PROJECT_PATH }}/Library
key: Library-${{ matrix.targetPlatform }} key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2 - uses: game-ci/unity-builder@v2
with: with: