From 9fd6055579691253da417ab60822a914b2fa8206 Mon Sep 17 00:00:00 2001 From: Skydust Date: Mon, 25 Nov 2024 08:19:19 +0100 Subject: [PATCH] Passing vars differently because of how broken it is --- action.yml | 9 +-------- entrypoint.sh | 12 ++++++++++-- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/action.yml b/action.yml index 47f88df..4a5a535 100644 --- a/action.yml +++ b/action.yml @@ -15,7 +15,7 @@ inputs: description: The dockerfile path required: false default: "." - pushImage: + push: description: Should push the built image required: false default: "true" @@ -36,10 +36,3 @@ outputs: runs: using: docker image: Dockerfile - env: - INPUT_IMAGE_NAME: ${{ inputs.imageName }} - INPUT_IMAGE_PREFIX: ${{ inputs.imagePrefix }} - INPUT_PUSH_IMAGE: ${{ inputs.pushImage }} - INPUT_PULL_CACHE: ${{ inputs.pullCache }} - INPUT_DOCKERFILE_PATH: ${{ inputs.path }} - INPUT_PLATFORM: ${{ inputs.platform }} diff --git a/entrypoint.sh b/entrypoint.sh index fad9fda..5f4a9ec 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,11 +1,18 @@ #!/usr/bin/env bash +INPUT_IMAGE_NAME=$imageName +INPUT_IMAGE_PREFIX=$imagePrefix +INPUT_PUSH_IMAGE=$push +INPUT_PULL_CACHE=$pullCache +INPUT_DOCKERFILE_PATH=$path +INPUT_PLATFORM=$platform + set -e # shellcheck disable=SC2155 export LOWERCASE_INPUT_IMAGE_PREFIX="$(echo "$INPUT_IMAGE_PREFIX" | tr '[:upper:]' '[:lower:]')" IMAGE_NAME="$(echo "$LOWERCASE_INPUT_IMAGE_PREFIX" | sed 's/^https\?:\/\///')$INPUT_IMAGE_NAME" -env + if [ -n "$DOCKER_CONFIG_BASE64" ]; then echo "Retrieving docker config" mkdir "$HOME/.docker/" @@ -35,11 +42,12 @@ if [ "$INPUT_PULL_CACHE" = "true" ]; then docker pull "$IMAGE_NAME" || echo "Unable to find an image to pull." fi +DOCKER_BUILD_OPTIONS+=("${INPUT_DOCKERFILE_PATH}") # shellcheck disable=SC2145 echo "Running docker buildx with options: ${DOCKER_BUILD_OPTIONS[@]}" echo "Building and pushing !" -docker buildx build DOCKER_BUILD_OPTIONS[@] "${INPUT_DOCKERFILE_PATH}" +docker buildx build "${DOCKER_BUILD_OPTIONS[@]}" echo "imageName=${IMAGE_NAME}" >>"$GITEA_OUTPUT"