From 5ff1f840dc978f9f4350b748c749f01b1371d35e Mon Sep 17 00:00:00 2001 From: peet Date: Fri, 24 Apr 2026 21:59:31 +0200 Subject: [PATCH] fix github_env --- podman-build-publish/action.yaml | 34 +++++++++++--------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/podman-build-publish/action.yaml b/podman-build-publish/action.yaml index 2c904e0..9618700 100644 --- a/podman-build-publish/action.yaml +++ b/podman-build-publish/action.yaml @@ -39,29 +39,16 @@ runs: run: | set -euo pipefail - # Fixed Podman storage paths — re-derived in each step to avoid - # relying on GITHUB_ENV propagation between composite action steps. - podman_root="${RUNNER_TEMP}/podman-root" - podman_runroot="${RUNNER_TEMP}/podman-runroot" + rm -rf "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot" + mkdir -p "${RUNNER_TEMP}/podman-root" "${RUNNER_TEMP}/podman-runroot" - rm -rf "${podman_root}" "${podman_runroot}" - mkdir -p "${podman_root}" "${podman_runroot}" - - # Export only input-derived values that cannot be recomputed later. - { - echo "IMAGE_BASE=registry.noctrl.eu/${{ inputs.image-name }}" - } >> "${GITHUB_ENV}" - - # Parse and validate tags + # Validate tags early so failures are caught before build starts mapfile -t tags < <(printf '%s\n' "${{ inputs.tags }}" | tr ', ' '\n\n' | sed '/^$/d') if [[ ${#tags[@]} -eq 0 ]]; then echo "ERROR: no tags resolved from inputs.tags" >&2 exit 1 fi - # Export tags as newline-separated string for subsequent steps - (IFS=$'\n'; echo "IMAGE_TAGS=${tags[*]}") >> "${GITHUB_ENV}" - - id: login shell: bash run: | @@ -87,6 +74,7 @@ runs: --storage-driver vfs ) + image_base="registry.noctrl.eu/${{ inputs.image-name }}" build_cmd=(podman "${podman_args[@]}" build --isolation chroot -f "${{ inputs.containerfile }}") # Add build args @@ -99,9 +87,9 @@ runs: echo "Building image with tags:" while IFS= read -r tag; do [[ -z "${tag}" ]] && continue - echo " ${IMAGE_BASE}:${tag}" - build_cmd+=(-t "${IMAGE_BASE}:${tag}") - done <<< "${IMAGE_TAGS}" + echo " ${image_base}:${tag}" + build_cmd+=(-t "${image_base}:${tag}") + done < <(printf '%s\n' "${{ inputs.tags }}" | tr ', ' '\n\n' | sed '/^$/d') build_cmd+=("${{ inputs.context }}") "${build_cmd[@]}" @@ -117,9 +105,11 @@ runs: --storage-driver vfs ) + image_base="registry.noctrl.eu/${{ inputs.image-name }}" + echo "Pushing image tags:" while IFS= read -r tag; do [[ -z "${tag}" ]] && continue - echo " ${IMAGE_BASE}:${tag}" - podman "${podman_args[@]}" push "${IMAGE_BASE}:${tag}" - done <<< "${IMAGE_TAGS}" + echo " ${image_base}:${tag}" + podman "${podman_args[@]}" push "${image_base}:${tag}" + done < <(printf '%s\n' "${{ inputs.tags }}" | tr ', ' '\n\n' | sed '/^$/d')