Skip to content

Commit

Permalink
fail if multiple archs are passed
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveitaly committed Jun 16, 2024
1 parent d2e3f7b commit d6d245c
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,6 @@ for label in "${LABELS[@]}"; do
BUILD_CMD="$BUILD_CMD --label $label"
done

if [ -n "${INPUT_PLATFORMS}" ]; then
read -ra PLATFORMS <<< "$(echo "$INPUT_PLATFORMS" | tr ',\n' ' ')"
for platform in "${PLATFORMS[@]}"; do
BUILD_CMD="$BUILD_CMD --platform $platform"
done
fi

if [ -n "${INPUT_PKGS}" ]; then
read -ra PKGS_ARR <<< "$(echo "$INPUT_PKGS" | tr ',\n' ' ')"
BUILD_CMD="$BUILD_CMD --pkgs '${PKGS_ARR[*]}'"
Expand All @@ -66,10 +59,26 @@ if [ -n "${INPUT_ENV}" ]; then
done
fi

# Execute the Nixpacks build command
echo "Executing Nixpacks build command:"
echo "$BUILD_CMD"

if [ -n "${INPUT_PLATFORMS}" ]; then
read -ra PLATFORMS <<< "$(echo "$INPUT_PLATFORMS" | tr ',\n' ' ')"
fi

if [ "${#PLATFORMS[@]}" -gt 1 ] && [ "$INPUT_PUSH" != "true" ]; then
echo "Multi-platform builds *must* be pushed to a registry. Please set 'push: true' in your action configuration or do a single architecture build."
exit 1
fi

if [ "${#PLATFORMS[@]}" -gt 1 ]; then
echo "Multi platform builds not supported yet"
exit 1
# for platform in "${PLATFORMS[@]}"; do
else
BUILD_CMD="$BUILD_CMD --platform ${PLATFORMS[0]}"
fi

eval "$BUILD_CMD"

# Conditionally push the images based on the 'push' input
Expand Down

0 comments on commit d6d245c

Please sign in to comment.