Updated unity actions.
This commit is contained in:
@@ -28,6 +28,15 @@ inputs:
|
|||||||
description: "Whether or not to use the graphics device when running Unity."
|
description: "Whether or not to use the graphics device when running Unity."
|
||||||
required: false
|
required: false
|
||||||
default: "true"
|
default: "true"
|
||||||
|
catchErrors:
|
||||||
|
description: "Whether or not errors should be handled."
|
||||||
|
required: false
|
||||||
|
sshPublicKey:
|
||||||
|
description: "Public SSH key to use for git package restoration."
|
||||||
|
required: false
|
||||||
|
sshPrivateKey:
|
||||||
|
description: "Private SSH key to use for git package restoration."
|
||||||
|
required: false
|
||||||
unityBuilder:
|
unityBuilder:
|
||||||
description: "Whether or not to use the UnityBuilder instead of a Unity command."
|
description: "Whether or not to use the UnityBuilder instead of a Unity command."
|
||||||
required: false
|
required: false
|
||||||
@@ -71,6 +80,10 @@ runs:
|
|||||||
shell: bash
|
shell: bash
|
||||||
- name: "Run Unity command."
|
- name: "Run Unity command."
|
||||||
uses: act/unity/unity@master
|
uses: act/unity/unity@master
|
||||||
|
env:
|
||||||
|
SSH_PUBLIC_KEY: ${{ inputs.sshPublicKey }}
|
||||||
|
SSH_PRIVATE_KEY: ${{ inputs.sshPrivateKey }}
|
||||||
|
CATCH_ERRORS: ${{ inputs.catchErrors }}
|
||||||
with:
|
with:
|
||||||
serial: ${{ inputs.serial }}
|
serial: ${{ inputs.serial }}
|
||||||
# serial: "activated"
|
# serial: "activated"
|
||||||
|
|||||||
@@ -22,3 +22,9 @@ else
|
|||||||
unity-editor $DEFAULT_ARGS $COMMAND
|
unity-editor $DEFAULT_ARGS $COMMAND
|
||||||
fi
|
fi
|
||||||
echo "::endgroup::"
|
echo "::endgroup::"
|
||||||
|
|
||||||
|
echo "exitCode=$RESULT" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
if [[ "$CATCH_ERRORS" != "true" ]]; then
|
||||||
|
exit $RESULT
|
||||||
|
fi
|
||||||
|
|||||||
109
unity-project-cached/action.yaml
Normal file
109
unity-project-cached/action.yaml
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
name: unity-project-cached
|
||||||
|
description: "Run a Unity command using a project's version and a build target. Cache the library folder."
|
||||||
|
inputs:
|
||||||
|
projectPath:
|
||||||
|
description: "Path to the Unity project."
|
||||||
|
required: true
|
||||||
|
default: "."
|
||||||
|
platform:
|
||||||
|
description: "Unity Platform. Options: windows, windows32bit, mac, linux, android"
|
||||||
|
required: true
|
||||||
|
serial:
|
||||||
|
description: "Unity license serial number."
|
||||||
|
required: false
|
||||||
|
email:
|
||||||
|
description: "Unity email."
|
||||||
|
required: true
|
||||||
|
password:
|
||||||
|
description: "Unity password."
|
||||||
|
required: true
|
||||||
|
executeMethod:
|
||||||
|
description: "Unity method to call."
|
||||||
|
required: false
|
||||||
|
command:
|
||||||
|
description: "Additional unity commands."
|
||||||
|
required: false
|
||||||
|
noGraphics:
|
||||||
|
description: "Whether or not to use the graphics device when running Unity."
|
||||||
|
required: false
|
||||||
|
default: "true"
|
||||||
|
buildOnCacheHit:
|
||||||
|
description: "Whether or not to build if a cache was found. Default: true"
|
||||||
|
required: false
|
||||||
|
default: "true"
|
||||||
|
sshPublicKey:
|
||||||
|
description: "Public SSH key to use for git package restoration."
|
||||||
|
required: false
|
||||||
|
sshPrivateKey:
|
||||||
|
description: "Private SSH key to use for git package restoration."
|
||||||
|
required: false
|
||||||
|
cacheSuffix:
|
||||||
|
description: "Suffix or hash to use for the cache key."
|
||||||
|
required: false
|
||||||
|
default: ${{ github.sha }}
|
||||||
|
cachePrefix:
|
||||||
|
description: "Prefix to use for the cache key."
|
||||||
|
required: false
|
||||||
|
default: unity-library
|
||||||
|
releaseBranch:
|
||||||
|
description: "Release name to use for the middle of the cache key if an exact release match was not found."
|
||||||
|
required: false
|
||||||
|
default: release
|
||||||
|
cachePath:
|
||||||
|
description: "Cache path. Default: Library"
|
||||||
|
required: false
|
||||||
|
default: Library
|
||||||
|
outputs:
|
||||||
|
cacheChanged:
|
||||||
|
description: "Whether or not the cache was changed."
|
||||||
|
value: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: "Get full cache key and build command."
|
||||||
|
id: command
|
||||||
|
run: |
|
||||||
|
# Get the full cache id.
|
||||||
|
echo "key=${{ inputs.cachePrefix }}-${{ github.ref_name }}-${{ inputs.cacheSuffix }}" >> "$GITHUB_OUTPUT"
|
||||||
|
# Get the build command.
|
||||||
|
COMMAND="${{ inputs.command }}"
|
||||||
|
if [[ -n "${{ inputs.executeMethod }}" ]]; then
|
||||||
|
COMMAND="$COMMAND -executeMethod ${{ inputs.executeMethod }}"
|
||||||
|
fi
|
||||||
|
echo "command=$COMMAND" >> "$GITHUB_OUTPUT"
|
||||||
|
shell: bash
|
||||||
|
- name: "Check if cache exists."
|
||||||
|
id: check-cache
|
||||||
|
uses: https://github.com/actions/cache/restore@v3
|
||||||
|
with:
|
||||||
|
path: ${{ inputs.cachePath }}
|
||||||
|
key: ${{ steps.command.outputs.key }}
|
||||||
|
lookup-only: true
|
||||||
|
- name: "Restore Library from Cache."
|
||||||
|
if: ${{ ( inputs.buildOnCacheHit == 'true' || steps.check-cache.outputs.cache-hit != 'true' ) }}
|
||||||
|
uses: https://github.com/actions/cache/restore@v3
|
||||||
|
with:
|
||||||
|
path: ${{ inputs.cachePath }}
|
||||||
|
key: ${{ steps.command.outputs.key }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ inputs.cachePrefix }}-${{ github.ref_name }}
|
||||||
|
${{ inputs.cachePrefix }}-${{ inputs.releaseBranch }}
|
||||||
|
${{ inputs.cachePrefix }}
|
||||||
|
- name: "Build project."
|
||||||
|
if: ${{ inputs.buildOnCacheHit == 'true' || steps.check-cache.outputs.cache-hit != 'true' }}
|
||||||
|
uses: act/unity/unity-project@master
|
||||||
|
with:
|
||||||
|
platform: ${{ inputs.platform }}
|
||||||
|
serial: ${{ inputs.serial }}
|
||||||
|
email: ${{ inputs.email }}
|
||||||
|
password: ${{ inputs.password }}
|
||||||
|
sshPublicKey: ${{ inputs.sshPublicKey }}
|
||||||
|
sshPrivateKey: ${{ inputs.sshPrivateKey }}
|
||||||
|
command: ${{ steps.command.outputs.command }}
|
||||||
|
noGraphics: ${{ inputs.noGraphics }}
|
||||||
|
- name: "Upload Library to Cache."
|
||||||
|
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
|
||||||
|
uses: https://github.com/actions/cache/save@v3
|
||||||
|
with:
|
||||||
|
path: ${{ inputs.cachePath }}
|
||||||
|
key: ${{ steps.command.outputs.key }}
|
||||||
@@ -9,9 +9,8 @@ inputs:
|
|||||||
description: "Unity Platform. Options: windows, windows32bit, mac, linux, android"
|
description: "Unity Platform. Options: windows, windows32bit, mac, linux, android"
|
||||||
required: true
|
required: true
|
||||||
serial:
|
serial:
|
||||||
description: "Unity license serial number. Or 'personal' for a personal license."
|
description: "Unity license serial number."
|
||||||
required: true
|
required: true
|
||||||
default: personal
|
|
||||||
email:
|
email:
|
||||||
description: "Unity email."
|
description: "Unity email."
|
||||||
required: true
|
required: true
|
||||||
@@ -21,39 +20,40 @@ inputs:
|
|||||||
command:
|
command:
|
||||||
description: "Unity command to run."
|
description: "Unity command to run."
|
||||||
required: false
|
required: false
|
||||||
unityBuilder:
|
|
||||||
description: "Whether or not to use the UnityBuilder instead of a Unity command."
|
|
||||||
required: false
|
|
||||||
noGraphics:
|
noGraphics:
|
||||||
description: "Whether or not to use the graphics device when running Unity."
|
description: "Whether or not to use the graphics device when running Unity."
|
||||||
required: false
|
required: false
|
||||||
default: "true"
|
default: "true"
|
||||||
cacheVolume:
|
sshPublicKey:
|
||||||
description: "Name of the volume to cache the Library folder to."
|
description: "Public SSH key to use for git package restoration."
|
||||||
required: false
|
required: false
|
||||||
removeContainer:
|
sshPrivateKey:
|
||||||
description: "Remove the mock container after building."
|
description: "Private SSH key to use for git package restoration."
|
||||||
required: false
|
required: false
|
||||||
default: "false"
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
|
- name: "Replace spaces in project path."
|
||||||
|
id: path
|
||||||
|
run: |
|
||||||
|
PROJECT_PATH=${{ inputs.projectPath }}
|
||||||
|
PROJECT_PATH=${PROJECT_PATH// /\\ }
|
||||||
|
echo "projectPath=$PROJECT_PATH" >> "$GITHUB_OUTPUT"
|
||||||
|
shell: bash
|
||||||
- name: "Get Unity Version."
|
- name: "Get Unity Version."
|
||||||
id: getVersion
|
id: getVersion
|
||||||
uses: act/unity/unity-get-version@master
|
uses: act/unity/unity-get-version@master
|
||||||
with:
|
with:
|
||||||
projectPath: ${{ inputs.projectPath }}
|
projectPath: ${{ steps.path.outputs.projectPath }}
|
||||||
- name: "Get Unity buildTarget."
|
- name: "Get Unity buildTarget."
|
||||||
id: getTarget
|
id: getTarget
|
||||||
uses: act/unity/unity-get-buildtarget@master
|
uses: act/unity/unity-get-buildtarget@master
|
||||||
with:
|
with:
|
||||||
platform: ${{ inputs.platform }}
|
platform: ${{ inputs.platform }}
|
||||||
- name: "Restore the cached Library folder."
|
- name: "Restore NugetForUnity packages if they exist."
|
||||||
if: inputs.cacheVolume != null
|
uses: act/dotnet/dotnet-nugetforunity-restore@master
|
||||||
uses: act/common/docker/docker-cp@master
|
|
||||||
with:
|
with:
|
||||||
volume: ${{ inputs.cacheVolume }}
|
projectPath: ${{ steps.path.outputs.projectPath }}
|
||||||
toPath: .
|
|
||||||
- name: "Run Unity command."
|
- name: "Run Unity command."
|
||||||
uses: act/unity/unity-command@master
|
uses: act/unity/unity-command@master
|
||||||
with:
|
with:
|
||||||
@@ -62,13 +62,7 @@ runs:
|
|||||||
serial: ${{ inputs.serial }}
|
serial: ${{ inputs.serial }}
|
||||||
email: ${{ inputs.email }}
|
email: ${{ inputs.email }}
|
||||||
password: ${{ inputs.password }}
|
password: ${{ inputs.password }}
|
||||||
command: -projectPath ${{ inputs.projectPath }} -buildTarget ${{ steps.getTarget.outputs.buildTarget }} ${{ inputs.command }}
|
sshPublicKey: ${{ inputs.sshPublicKey }}
|
||||||
removeContainer: ${{ inputs.removeContainer }}
|
sshPrivateKey: ${{ inputs.sshPrivateKey }}
|
||||||
noGraphics: ${{ inputs.noGraphics }}
|
noGraphics: ${{ inputs.noGraphics }}
|
||||||
- name: "Cache the Library folder."
|
command: -projectPath ${{ steps.path.outputs.projectPath }} -buildTarget ${{ steps.getTarget.outputs.buildTarget }} ${{ inputs.command }}
|
||||||
if: inputs.cacheVolume != null
|
|
||||||
uses: act/common/docker/docker-cp@master
|
|
||||||
with:
|
|
||||||
recreateVolume: true
|
|
||||||
volume: ${{ inputs.cacheVolume }}
|
|
||||||
fromPath: Library
|
|
||||||
|
|||||||
Reference in New Issue
Block a user