Added many, many more actions.

This commit is contained in:
2025-06-24 15:24:16 -07:00
parent 62fbe4dead
commit 57ef232d2b
108 changed files with 4212 additions and 7 deletions

View File

@@ -0,0 +1,22 @@
#Arg is replaced with the desired Unity container.
ARG IMAGE=unityci/base:latest
FROM ${IMAGE}
RUN apt update
RUN apt install -y wget chromium-browser
#ADD https://minio.studiowhy.net/hackmd/UnityBuilder /usr/local/bin/
COPY UnityBuilder /usr/local/bin/
RUN chmod +x /usr/local/bin/UnityBuilder
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh
COPY scripts/. /scripts
# Commented out until better image selection is enabled.
# RUN --mount=type=secret,id=SERIAL \
# --mount=type=secret,id=USERNAME \
# --mount=type=secret,id=PASSWORD \
# bash /scripts/activate_license.sh
ENTRYPOINT ["/entrypoint.sh"]

Binary file not shown.

View File

@@ -0,0 +1,84 @@
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
noGraphics:
description: "Whether or not to use the graphics device when running Unity."
required: false
default: "true"
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"
# 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 }}
docker build -t $CACHED_CONTAINER --build-arg IMAGE=$CONTAINER ${{ github.action_path }}
docker tag $CACHED_CONTAINER ${{ inputs.imageTag }}
shell: bash
- name: "Get Unity Command."
id: command
run: |
COMMAND="${{ inputs.command }}"
NO_GRAPHICS="${{ inputs.noGraphics }}"
if [[ "$NO_GRAPHICS" == "true" ]]; then
COMMAND="-nographics $COMMAND"
fi
echo "command=$COMMAND" >> "$GITHUB_OUTPUT"
- name: "Run Unity command."
uses: act/unity/unity@master
with:
serial: ${{ inputs.serial }}
# serial: "activated"
email: ${{ inputs.email }}
password: ${{ inputs.password }}
command: ${{ steps.command.outputs.command }}
unityBuilder: ${{ inputs.unityBuilder }}
- name: "Remove temporary image."
if: ${{ inputs.removeContainer == 'true' }}
run: |
docker image rm ${{ inputs.imageTag }}
shell: bash

View File

@@ -0,0 +1,24 @@
#!/bin/bash
SERIAL=$1; EMAIL=$2; PASSWORD=$3; COMMAND=$4; UNITY_BUILDER=$5
DEFAULT_ARGS="-quit -logFile -"
rm -rf $HOME/.config/unity3d
rm -rf /home/unity/.config/unity3d
#Add ssh key information for resolving packages.
bash /scripts/add_ssh_keys.sh
if [[ "$SERIAL" != "activated" ]]; then
echo "::group::Activating Unity License"
bash /scripts/activate_license.sh "$SERIAL" "$EMAIL" "$PASSWORD"
echo "::endgroup::"
fi
echo "::group::Running Unity Command"
#Run the command.
if [[ -n "$UNITY_BUILDER" ]]; then
UnityBuilder $COMMAND
else
unity-editor $DEFAULT_ARGS $COMMAND
fi
echo "::endgroup::"

View File

@@ -0,0 +1,29 @@
#!/bin/bash
SERIAL=$1; USERNAME=$2; PASSWORD=$3;
function check_path
{
local SECRET_PATH="/run/secrets"
local ENV_NAME="$1"
local ENV_VALUE="${!ENV_NAME}"
local FILE_PATH="$SECRET_PATH/$ENV_NAME"
if [[ -z "$ENV_VALUE" && -f "$FILE_PATH" ]]; then
export $ENV_NAME=$(cat "$FILE_PATH")
fi
}
check_path SERIAL
check_path USERNAME
check_path PASSWORD
if [[ -z "$SERIAL" || -z "$USERNAME" || -z "$PASSWORD" ]]; then
exit 0
fi
#Activate Unity
if [[ "$SERIAL" == "personal" ]]; then
UnityBuilder activate -i /usr/bin/unity-editor -u $USERNAME -p $PASSWORD
else
unity-editor $DEFAULT_ARGS -serial $SERIAL -username $USERNAME -password $PASSWORD
fi

View File

@@ -0,0 +1,17 @@
#!/bin/bash
if [[ -n "$SSH_PUBLIC_KEY" && -n "$SSH_PRIVATE_KEY" ]]; then
echo "ADDING SSH KEYS!"
SSH_DIR="/home/$(whoami)/.ssh"
mkdir -p $SSH_DIR
echo "$SSH_PUBLIC_KEY" > $SSH_DIR/id_rsa.pub
echo "$SSH_PRIVATE_KEY" > $SSH_DIR/id_rsa
cat << EOF > $SSH_DIR/config
Host *
StrictHostKeyChecking no
EOF
chmod 600 $SSH_DIR/id_rsa
chmod 644 $SSH_DIR/id_rsa.pub
cat $SSH_DIR/config
fi