check for apt-get before installing jq

pull/164/head
Aaron Trudeau 2022-01-17 13:30:18 -05:00
parent da456a3fa0
commit 3f24118d3e
No known key found for this signature in database
GPG Key ID: 29F89A9BDAAF7BDE
3 changed files with 22 additions and 8 deletions

View File

@ -47,7 +47,7 @@ inputs:
packageMode:
required: false
default: false
description: 'Whether the tests are being run for a Unity package. Not needed for packages located within a Unity Project.'
description: 'Whether the tests are being run for a Unity package instead of a Unity project. NOTE: If this is true, any custom docker image you pass must be compatible with apt-get.'
outputs:
artifactsPath:
description: 'Path where the artifacts are stored'

7
dist/Dockerfile vendored
View File

@ -10,13 +10,6 @@ LABEL "repository"="http://github.com/webbertakken/unity-actions"
LABEL "homepage"="http://github.com/webbertakken/unity-actions"
LABEL "maintainer"="Webber Takken <webber@takken.io>"
RUN apt-get update \
&& apt-get upgrade -y --force-yes \
&& apt-get install -y --force-yes \
jq \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/*
ADD steps /steps
RUN chmod -R +x /steps
ADD entrypoint.sh /entrypoint.sh

21
dist/entrypoint.sh vendored
View File

@ -7,6 +7,27 @@
ACTIVATE_LICENSE_PATH="$GITHUB_WORKSPACE/_activate-license"
mkdir -p "$ACTIVATE_LICENSE_PATH"
#
# Check if apt-get is available if in package mode (if not, we must abort since we need to install jq)
#
if [ "$PACKAGE_MODE" = "true" ]; then
echo "Running tests on a Unity package rather than a Unity project."
echo "Checking if apt-get is installed."
apt-get --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "apt-get is not installed. Aborting..."
exit
fi
# install jq
apt-get update \
&& apt-get upgrade -y --force-yes \
&& apt-get install -y --force-yes \
jq \
&& apt-get clean \
&& rm -rf /var/cache/apt/archives/* /var/lib/apt/lists/*
fi
#
# Run steps
#