This commit is contained in:
2023-03-25 21:53:41 -07:00
parent 40fd87e4b9
commit ad98e1b5b8
3 changed files with 31 additions and 13 deletions

View File

@@ -2,10 +2,6 @@
ARG IMAGE=unityci/base:latest ARG IMAGE=unityci/base:latest
FROM ${IMAGE} FROM ${IMAGE}
ARG SERIAL
ARG USERNAME
ARG PASSWORD
RUN apt update RUN apt update
RUN apt install -y wget chromium-browser RUN apt install -y wget chromium-browser
@@ -16,6 +12,9 @@ COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh RUN chmod +x /entrypoint.sh
COPY scripts/. /scripts COPY scripts/. /scripts
RUN bash /scripts/activate_license.sh ${SERIAL} ${USERNAME} ${PASSWORD} RUN --mount=type=secret,id=SERIAL \
--mount=type=secret,id=USERNAME \
--mount=type=secret,id=PASSWORD \
bash /scripts/activate_license.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View File

@@ -44,14 +44,17 @@ runs:
run: | run: |
CONTAINER=${{ steps.getContainer.outputs.container }} CONTAINER=${{ steps.getContainer.outputs.container }}
docker build -t ${{ inputs.imageTag }} --build-arg IMAGE=$CONTAINER ${{ github.action_path }} SERIAL="${{ inputs.serial }}" USERNAME="${{ inputs.email }}" PASSWORD="${{ inputs.password }}" \
# Activate the license on build.
docker build . --secret id=SERIAL,env=SERIAL --secret id=USERNAME,env=USERNAME --secret id=PASSWORD,env=PASSWORD \
-t ${{ inputs.imageTag }} --build-arg IMAGE=$CONTAINER ${{ github.action_path }}
shell: bash shell: bash
- name: "Run Unity command." - name: "Run Unity command."
uses: act/unity/unity@master uses: act/unity/unity@master
with: with:
serial: ${{ inputs.serial }} # serial: ${{ inputs.serial }}
email: ${{ inputs.email }} # email: ${{ inputs.email }}
password: ${{ inputs.password }} # password: ${{ inputs.password }}
command: ${{ inputs.command }} command: ${{ inputs.command }}
unityBuilder: ${{ inputs.unityBuilder }} unityBuilder: ${{ inputs.unityBuilder }}
- name: "Remove temporary image." - name: "Remove temporary image."

View File

@@ -1,13 +1,29 @@
#!/bin/bash #!/bin/bash
SERIAL=$1; EMAIL=$2; PASSWORD=$3; SERIAL=$1; USERNAME=$2; PASSWORD=$3;
if [[ -z "$SERIAL" || -z "$EMAIL" || -z "$PASSWORD" ]]; then 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 exit 0
fi fi
#Activate Unity #Activate Unity
if [[ "$SERIAL" == "personal" ]]; then if [[ "$SERIAL" == "personal" ]]; then
UnityBuilder activate -i /usr/bin/unity-editor -u $EMAIL -p $PASSWORD UnityBuilder activate -i /usr/bin/unity-editor -u $USERNAME -p $PASSWORD
else else
unity-editor $DEFAULT_ARGS -serial $SERIAL -username $EMAIL -password $PASSWORD unity-editor $DEFAULT_ARGS -serial $SERIAL -username $USERNAME -password $PASSWORD
fi fi