Files
unity/unity-command/action.yaml
2023-03-25 22:13:30 -07:00

72 lines
2.4 KiB
YAML

name: unity-command
description: "Run a Unity command using a specified version of Unity."
inputs:
platform:
description: "Unity Platform. Options: windows, windows32bit, mac, linux, android"
required: true
version:
description: "Unity Version."
required: true
imageTag:
description: "Tag to use for the temporary version of Unity. Must refer to an existing public Docker image. Must be the same is in the Dockerfile of the called action."
required: true
default: unityci/base:latest
serial:
description: "Unity license serial number. Or 'public' for a public license."
required: true
default: public
email:
description: "Unity email."
required: true
password:
description: "Unity password."
required: true
command:
description: "Unity command to run."
required: false
unityBuilder:
description: "Whether or not to use the UnityBuilder instead of a Unity command."
required: false
removeContainer:
description: "Remove the mock container after building."
required: false
default: "true"
runs:
using: "composite"
steps:
- name: "Get Unity container name."
id: getContainer
uses: act/unity/unity-get-container@master
with:
version: ${{ inputs.version }}
platform: ${{ inputs.platform }}
- name: "Pull Unity container."
run: |
CONTAINER="${{ steps.getContainer.outputs.container }}"
CACHED_CONTAINER="$CONTAINER-activated"
if [[ -z "$(docker image ls | grep $CACHED_CONTAINER)" ]]; then
# Activate the license on build.
DOCKER_BUILDKIT=1 \
SERIAL="${{ inputs.serial }}" USERNAME="${{ inputs.email }}" PASSWORD="${{ inputs.password }}" \
docker build --secret id=SERIAL,env=SERIAL --secret id=USERNAME,env=USERNAME --secret id=PASSWORD,env=PASSWORD \
-t $CACHED_CONTAINER --build-arg IMAGE=$CONTAINER ${{ github.action_path }}
fi
docker tag $CACHED_CONTAINER ${{ inputs.imageTag }}
shell: bash
- name: "Run Unity command."
uses: act/unity/unity@master
with:
# serial: ${{ inputs.serial }}
serial: "activated"
email: ${{ inputs.email }}
password: ${{ inputs.password }}
command: ${{ inputs.command }}
unityBuilder: ${{ inputs.unityBuilder }}
- name: "Remove temporary image."
if: ${{ inputs.removeContainer == 'true' }}
run: |
docker image rm ${{ inputs.imageTag }}
shell: bash