Updated cached artifacts.
This commit is contained in:
118
unity-project-cached-artifacts/action.yaml
Normal file
118
unity-project-cached-artifacts/action.yaml
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
name: unity-project-cached
|
||||||
|
description: "Run a Unity command using a project's version and a build target. Cache the library folder. Upload artifacts after the build."
|
||||||
|
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. Or 'personal' for a personal license."
|
||||||
|
required: true
|
||||||
|
default: personal
|
||||||
|
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"
|
||||||
|
unityBuilder:
|
||||||
|
description: "Whether or not to use the UnityBuilder instead of a Unity command."
|
||||||
|
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
|
||||||
|
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
|
||||||
|
compressionLevel:
|
||||||
|
description: "Compression level for the artifacts."
|
||||||
|
required: false
|
||||||
|
default: "9"
|
||||||
|
artifactSuffix:
|
||||||
|
description: "Suffix for the artifact name."
|
||||||
|
required: false
|
||||||
|
default: build
|
||||||
|
outputs:
|
||||||
|
cacheChanged:
|
||||||
|
description: "Whether or not the cache was changed."
|
||||||
|
value: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
|
||||||
|
artifactName:
|
||||||
|
description: "Name of the uploaded artifact."
|
||||||
|
value: "${{ steps.get_product_name.outputs.nameShort }}_${{ inputs.artifactSuffix }}"
|
||||||
|
artifactPath:
|
||||||
|
description: "Path to the uploaded artifact."
|
||||||
|
value: "${{ steps.find_output_dir.outputs.fullPath }}"
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: "Build Unity Project"
|
||||||
|
uses: act/unity/unity-project-cached@master
|
||||||
|
with:
|
||||||
|
projectPath: ${{ inputs.projectPath }}
|
||||||
|
platform: ${{ inputs.platform }}
|
||||||
|
serial: ${{ inputs.serial }}
|
||||||
|
email: ${{ inputs.email }}
|
||||||
|
password: ${{ inputs.password }}
|
||||||
|
executeMethod: ${{ inputs.executeMethod }}
|
||||||
|
command: ${{ inputs.command }}
|
||||||
|
noGraphics: ${{ inputs.noGraphics }}
|
||||||
|
buildOnCacheHit: ${{ inputs.buildOnCacheHit }}
|
||||||
|
unityBuilder: ${{ inputs.unityBuilder }}
|
||||||
|
sshPublicKey: ${{ inputs.sshPublicKey }}
|
||||||
|
sshPrivateKey: ${{ inputs.sshPrivateKey }}
|
||||||
|
cacheSuffix: ${{ inputs.cacheSuffix }}
|
||||||
|
cachePrefix: ${{ inputs.cachePrefix }}
|
||||||
|
releaseBranch: ${{ inputs.releaseBranch }}
|
||||||
|
cachePath: ${{ inputs.cachePath }}
|
||||||
|
- name: "Get product name."
|
||||||
|
id: get_product_name
|
||||||
|
uses: act/unity/unity-get-product-name@master
|
||||||
|
- name: "Find Output Directory"
|
||||||
|
id: find_output_dir
|
||||||
|
uses: act/common/utils/find-first@master
|
||||||
|
with:
|
||||||
|
path: Build
|
||||||
|
pattern: "*"
|
||||||
|
type: d
|
||||||
|
minDepth: 1
|
||||||
|
maxDepth: 1
|
||||||
|
- name: "Upload Artifacts"
|
||||||
|
uses: https://github.com/actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: "${{ steps.get_product_name.outputs.nameShort }}_${{ inputs.artifactSuffix }}"
|
||||||
|
path: "${{ steps.find_output_dir.outputs.fullPath }}"
|
||||||
|
if-no-files-found: error
|
||||||
|
compression-level: ${{ inputs.compressionLevel }}
|
||||||
@@ -64,51 +64,51 @@ outputs:
|
|||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
- name: "Get full cache key and build command."
|
- name: "Get full cache key and build command."
|
||||||
id: command
|
id: command
|
||||||
run: |
|
run: |
|
||||||
# Get the full cache id.
|
# Get the full cache id.
|
||||||
echo "key=${{ inputs.cachePrefix }}-${{ github.ref_name }}-${{ inputs.cacheSuffix }}" >> "$GITHUB_OUTPUT"
|
echo "key=${{ inputs.cachePrefix }}-${{ github.ref_name }}-${{ inputs.cacheSuffix }}" >> "$GITHUB_OUTPUT"
|
||||||
# Get the build command.
|
# Get the build command.
|
||||||
COMMAND="${{ inputs.command }}"
|
COMMAND="${{ inputs.command }}"
|
||||||
if [[ -n "${{ inputs.executeMethod }}" ]]; then
|
if [[ -n "${{ inputs.executeMethod }}" ]]; then
|
||||||
COMMAND="$COMMAND -executeMethod ${{ inputs.executeMethod }}"
|
COMMAND="$COMMAND -executeMethod ${{ inputs.executeMethod }}"
|
||||||
fi
|
fi
|
||||||
echo "command=$COMMAND" >> "$GITHUB_OUTPUT"
|
echo "command=$COMMAND" >> "$GITHUB_OUTPUT"
|
||||||
shell: bash
|
shell: bash
|
||||||
- name: "Check if cache exists."
|
- name: "Check if cache exists."
|
||||||
id: check-cache
|
id: check-cache
|
||||||
uses: https://github.com/actions/cache/restore@v3
|
uses: https://github.com/actions/cache/restore@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ inputs.cachePath }}
|
path: ${{ inputs.cachePath }}
|
||||||
key: ${{ steps.command.outputs.key }}
|
key: ${{ steps.command.outputs.key }}
|
||||||
lookup-only: true
|
lookup-only: true
|
||||||
- name: "Restore Library from Cache."
|
- name: "Restore Library from Cache."
|
||||||
if: ${{ ( inputs.buildOnCacheHit == 'true' || steps.check-cache.outputs.cache-hit != 'true' ) }}
|
if: ${{ ( inputs.buildOnCacheHit == 'true' || steps.check-cache.outputs.cache-hit != 'true' ) }}
|
||||||
uses: https://github.com/actions/cache/restore@v3
|
uses: https://github.com/actions/cache/restore@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ inputs.cachePath }}
|
path: ${{ inputs.cachePath }}
|
||||||
key: ${{ steps.command.outputs.key }}
|
key: ${{ steps.command.outputs.key }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ inputs.cachePrefix }}-${{ github.ref_name }}
|
${{ inputs.cachePrefix }}-${{ github.ref_name }}
|
||||||
${{ inputs.cachePrefix }}-${{ inputs.releaseBranch }}
|
${{ inputs.cachePrefix }}-${{ inputs.releaseBranch }}
|
||||||
${{ inputs.cachePrefix }}
|
${{ inputs.cachePrefix }}
|
||||||
- name: "Build project."
|
- name: "Build project."
|
||||||
if: ${{ inputs.buildOnCacheHit == 'true' || steps.check-cache.outputs.cache-hit != 'true' }}
|
if: ${{ inputs.buildOnCacheHit == 'true' || steps.check-cache.outputs.cache-hit != 'true' }}
|
||||||
uses: act/unity/unity-project@master
|
uses: act/unity/unity-project@master
|
||||||
with:
|
with:
|
||||||
platform: ${{ inputs.platform }}
|
platform: ${{ inputs.platform }}
|
||||||
serial: ${{ inputs.serial }}
|
serial: ${{ inputs.serial }}
|
||||||
email: ${{ inputs.email }}
|
email: ${{ inputs.email }}
|
||||||
password: ${{ inputs.password }}
|
password: ${{ inputs.password }}
|
||||||
sshPublicKey: ${{ inputs.sshPublicKey }}
|
sshPublicKey: ${{ inputs.sshPublicKey }}
|
||||||
sshPrivateKey: ${{ inputs.sshPrivateKey }}
|
sshPrivateKey: ${{ inputs.sshPrivateKey }}
|
||||||
command: ${{ steps.command.outputs.command }}
|
command: ${{ steps.command.outputs.command }}
|
||||||
noGraphics: ${{ inputs.noGraphics }}
|
noGraphics: ${{ inputs.noGraphics }}
|
||||||
unityBuilder: ${{ inputs.unityBuilder }}
|
unityBuilder: ${{ inputs.unityBuilder }}
|
||||||
- name: "Upload Library to Cache."
|
- name: "Upload Library to Cache."
|
||||||
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
|
if: ${{ steps.check-cache.outputs.cache-hit != 'true' }}
|
||||||
uses: https://github.com/actions/cache/save@v3
|
uses: https://github.com/actions/cache/save@v3
|
||||||
with:
|
with:
|
||||||
path: ${{ inputs.cachePath }}
|
path: ${{ inputs.cachePath }}
|
||||||
key: ${{ steps.command.outputs.key }}
|
key: ${{ steps.command.outputs.key }}
|
||||||
|
|||||||
Reference in New Issue
Block a user