Initial Commit.
This commit is contained in:
17
unity-command/Dockerfile
Normal file
17
unity-command/Dockerfile
Normal file
@@ -0,0 +1,17 @@
|
||||
#Arg is replaced with the desired Unity container.
|
||||
ARG IMAGE=debian:stable-slim
|
||||
FROM ${IMAGE}
|
||||
|
||||
RUN useradd -ms /bin/bash unity -u 1000
|
||||
|
||||
COPY entrypoint.sh /
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
COPY install-dotnet.sh /
|
||||
RUN bash /install-dotnet.sh
|
||||
|
||||
COPY UnityBuilder /usr/local/bin/
|
||||
RUN chmod +x /usr/local/bin/UnityBuilder
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
USER unity
|
||||
BIN
unity-command/UnityBuilder
Normal file
BIN
unity-command/UnityBuilder
Normal file
Binary file not shown.
52
unity-command/action.yaml
Normal file
52
unity-command/action.yaml
Normal file
@@ -0,0 +1,52 @@
|
||||
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
|
||||
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 }}
|
||||
|
||||
docker build -t ${{ inputs.imageTag }} --build-arg IMAGE=$CONTAINER ${{ github.action_path }}
|
||||
shell: bash
|
||||
- name: "Run Unity command."
|
||||
uses: act/unity/unity@master
|
||||
with:
|
||||
serial: ${{ inputs.serial }}
|
||||
email: ${{ inputs.email }}
|
||||
password: ${{ inputs.password }}
|
||||
command: ${{ inputs.command }}
|
||||
- name: "Remove temporary image."
|
||||
run: |
|
||||
docker image rm ${{ inputs.imageTag }}
|
||||
shell: bash
|
||||
34
unity-command/entrypoint.sh
Normal file
34
unity-command/entrypoint.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
SERIAL=$1; EMAIL=$2; PASSWORD=$3; COMMAND=$4
|
||||
DEFAULT_ARGS="-quit -logFile -"
|
||||
|
||||
rm -rf $HOME/.config/unity3d
|
||||
rm -rf /home/unity/.config/unity3d
|
||||
|
||||
#Add ssh key information for resolving packages.
|
||||
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
|
||||
|
||||
#Activate Unity
|
||||
if [[ "$SERIAL" == "public" ]]; then
|
||||
unity-editor $DEFAULT_ARGS -serial $SERIAL -username $EMAIL -password $PASSWORD
|
||||
else
|
||||
UnityBuilder -i unity-editor -u $EMAIL -p $PASSWORD
|
||||
fi
|
||||
|
||||
#Run the command.
|
||||
unity-editor $DEFAULT_ARGS $COMMAND
|
||||
10
unity-command/install-dotnet.sh
Normal file
10
unity-command/install-dotnet.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
|
||||
dpkg -i packages-microsoft-prod.deb
|
||||
rm packages-microsoft-prod.deb
|
||||
|
||||
apt update
|
||||
apt install -y dotnet-sdk-6.0
|
||||
|
||||
#For UnityBuilder
|
||||
apt install -y chromium-browser
|
||||
Reference in New Issue
Block a user