Merge pull request #14 from davidmfinol/addWorkflowdispatch

Update ReadMe.md and add workflow dispatch
This commit is contained in:
David Finol 2023-04-22 09:04:41 -05:00 committed by GitHub
commit 691a498057
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 55 deletions

View File

@ -3,35 +3,36 @@ name: Unity Actions
on: on:
pull_request: {} pull_request: {}
push: {} push: {}
workflow_dispatch: {}
env: ### Refer to https://game.ci/docs/github/getting-started
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
PROJECT_PATH: .
jobs: jobs:
checklicense: checklicense:
name: check if UNITY_LICENSE is set in github secrets name: Check for UNITY_LICENSE in GitHub Secrets
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
is_unity_license_set: ${{ steps.checklicense_job.outputs.is_unity_license_set }} is_unity_license_set: ${{ steps.checklicense_job.outputs.is_unity_license_set }}
steps: steps:
- name: Check whether unity activation requests should be done - name: Check whether unity activation requests should be done
id: checklicense_job id: checklicense_job
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
run: | run: |
echo "Skip activation job: ${{ env.UNITY_LICENSE != '' }}" echo "Skip activation job: ${{ env.UNITY_LICENSE != '' }}"
echo "::set-output name=is_unity_license_set::${{ env.UNITY_LICENSE != '' }}" export is_unity_license_set="${{ env.UNITY_LICENSE != '' }}"
echo "is_unity_license_set=$is_unity_license_set" >> $GITHUB_OUTPUT
activation: activation:
needs: [checklicense] needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'false' if: needs.checklicense.outputs.is_unity_license_set == 'false'
name: Request activation file 🔑 name: Request manual activation file 🔑
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
# Request manual activation file # Request manual activation file
- name: Request manual activation file - name: Request manual activation file
id: getManualLicenseFile id: getManualLicenseFile
# https://github.com/game-ci/unity-request-activation-file/releases/
uses: game-ci/unity-request-activation-file@v2 uses: game-ci/unity-request-activation-file@v2
# Upload artifact (Unity_v20XX.X.XXXX.alf) # Upload artifact (Unity_v20XX.X.XXXX.alf)
- name: Expose as artifact - name: Expose as artifact
@ -43,7 +44,7 @@ jobs:
test: test:
needs: [checklicense] needs: [checklicense]
if: needs.checklicense.outputs.is_unity_license_set == 'true' if: needs.checklicense.outputs.is_unity_license_set == 'true'
name: Test all modes ✨ name: Run all tests ✨
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -52,25 +53,22 @@ jobs:
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: Library path: Library
key: Library-test-project-${{ matrix.targetPlatform }} key: Library-test
restore-keys: |
Library-test-project-
Library-
# https://github.com/game-ci/unity-test-runner/releases/
- uses: game-ci/unity-test-runner@v2 - uses: game-ci/unity-test-runner@v2
id: testRunner id: testRunner
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with: with:
projectPath: ${{ env.PROJECT_PATH }} githubToken: ${{ secrets.GITHUB_TOKEN }}
testMode: all
customParameters: "-nographics"
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
name: Test results (all modes) name: Test results (all modes)
path: ${{ steps.testRunner.outputs.artifactsPath }} path: ${{ steps.testRunner.outputs.artifactsPath }}
build: build:
needs: [checklicense] needs: [test]
if: needs.checklicense.outputs.is_unity_license_set == 'true'
name: Build for ${{ matrix.targetPlatform }} name: Build for ${{ matrix.targetPlatform }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@ -87,15 +85,14 @@ jobs:
lfs: true lfs: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: ${{ matrix.projectPath }}/Library path: Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }} key: Library-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
# https://github.com/game-ci/unity-builder/releases/
- uses: game-ci/unity-builder@v2 - uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with: with:
projectPath: ${{ env.PROJECT_PATH }}
targetPlatform: ${{ matrix.targetPlatform }} targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3
with: with:
@ -103,8 +100,7 @@ jobs:
path: build path: build
buildWithMac: buildWithMac:
needs: [checklicense] needs: [build]
if: needs.checklicense.outputs.is_unity_license_set == 'true'
name: Build for ${{ matrix.targetPlatform }} name: Build for ${{ matrix.targetPlatform }}
runs-on: macos-latest runs-on: macos-latest
strategy: strategy:
@ -113,30 +109,56 @@ jobs:
targetPlatform: targetPlatform:
- StandaloneOSX - StandaloneOSX
steps: steps:
- name: Checkout Repository - uses: actions/checkout@v3
uses: actions/checkout@v3
with: with:
lfs: true lfs: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: ${{ matrix.projectPath }}/Library path: Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }} key: Library-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
- uses: game-ci/unity-builder@v2 - uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with: with:
projectPath: ${{ env.PROJECT_PATH }}
targetPlatform: ${{ matrix.targetPlatform }} targetPlatform: ${{ matrix.targetPlatform }}
- name: Upload Build - uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v3
with: with:
name: Build-${{ matrix.targetPlatform }} name: Build-${{ matrix.targetPlatform }}
path: build path: build
buildWithWindows: buildWithWindows:
needs: [build, buildWithMac] needs: build
if: needs.checklicense.outputs.is_unity_license_set == 'true' name: Build for ${{ matrix.targetPlatform }}
runs-on: windows-2019
strategy:
fail-fast: false
matrix:
targetPlatform:
- WSAPlayer
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/cache@v3
with:
path: Library
key: Library-${{ matrix.targetPlatform }}
- uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with:
targetPlatform: ${{ matrix.targetPlatform }}
- uses: actions/upload-artifact@v3
with:
name: Build-${{ matrix.targetPlatform }}
path: build
buildWithWindows2:
needs: buildWithWindows
name: Build for ${{ matrix.targetPlatform }} name: Build for ${{ matrix.targetPlatform }}
runs-on: windows-2019 runs-on: windows-2019
strategy: strategy:
@ -145,25 +167,22 @@ jobs:
targetPlatform: targetPlatform:
- StandaloneWindows - StandaloneWindows
- StandaloneWindows64 - StandaloneWindows64
- WSAPlayer
steps: steps:
- name: Checkout Repository - uses: actions/checkout@v3
uses: actions/checkout@v3
with: with:
lfs: true lfs: true
- uses: actions/cache@v3 - uses: actions/cache@v3
with: with:
path: ${{ matrix.projectPath }}/Library path: Library
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }} key: Library-${{ matrix.targetPlatform }}
restore-keys: |
Library-${{ matrix.projectPath }}-
Library-
- uses: game-ci/unity-builder@v2 - uses: game-ci/unity-builder@v2
env:
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
with: with:
projectPath: ${{ env.PROJECT_PATH }}
targetPlatform: ${{ matrix.targetPlatform }} targetPlatform: ${{ matrix.targetPlatform }}
- name: Upload Build - uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v3
with: with:
name: Build-${{ matrix.targetPlatform }} name: Build-${{ matrix.targetPlatform }}
path: build path: build

View File

@ -12,4 +12,4 @@ MonoBehaviour:
m_Script: {fileID: 0} m_Script: {fileID: 0}
m_Name: m_Name:
m_EditorClassIdentifier: Unity.Rider.Editor:Packages.Rider.Editor:RiderScriptEditorPersistedState m_EditorClassIdentifier: Unity.Rider.Editor:Packages.Rider.Editor:RiderScriptEditorPersistedState
lastWriteTicks: -8585491470484541603 lastWriteTicks: -8585194918909323212

View File

@ -1,6 +1,6 @@
# unity-actions example # unity-actions example
[![Actions 😎](https://github.com/GabLeRoux/unity-actions-example/workflows/Actions%20%F0%9F%98%8E/badge.svg)](https://github.com/GabLeRoux/unity-actions-example/actions) [![Unity Actions](https://github.com/game-ci/unity-actions-example/actions/workflows/main.yml/badge.svg)](https://github.com/game-ci/unity-actions-example/actions/workflows/main.yml)
Example using unity-actions to test and build a unity project. More information at [game.ci](https://game.ci/) Example using unity-actions to test and build a unity project. More information at [game.ci](https://game.ci/)