fix github_env
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user