Add error catching to tinyuf2 steps

This commit is contained in:
tyeth 2025-07-23 20:22:25 +01:00
parent 00ca0190f6
commit ca3d5c7d19

View file

@ -152,6 +152,7 @@ jobs:
- name: fetch tinyuf2 combined.bin
run: |
BOARD_NAME="${{fromJson(steps.get_board_json.outputs.boardJson).bootloaderBoardName}}"
set +e
for attempt in 1 2; do
echo "Attempt $attempt: Fetching tinyuf2 release info for board $BOARD_NAME"
API_RESPONSE=$(curl --silent --fail https://api.github.com/repos/adafruit/tinyuf2/releases/latest)
@ -159,21 +160,26 @@ jobs:
echo "Attempt $attempt: curl failed to fetch release info."
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; continue; fi
fi
DOWNLOAD_URL=$(echo "$API_RESPONSE" | jq -r '.assets[] | select(.browser_download_url | contains("tinyuf2-'$BOARD_NAME'-") and endswith(".zip")) | .browser_download_url // empty')
if [ -z "$DOWNLOAD_URL" ]; then
echo "Attempt $attempt: No matching tinyuf2 zip found for board $BOARD_NAME."
DOWNLOAD_URL=$(echo "$API_RESPONSE" | jq -r '.assets[] | select(.browser_download_url | contains("tinyuf2-'$BOARD_NAME'-") and endswith(".zip")) | .browser_download_url // empty'); JQ_EXIT=$?
if [ $JQ_EXIT -ne 0 ] || [ -z "$DOWNLOAD_URL" ]; then
echo "Attempt $attempt: jq failed or no matching zip found."
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; continue; fi
fi
echo "Attempt $attempt: Downloading $DOWNLOAD_URL"
wget "$DOWNLOAD_URL" -O tinyuf2.zip
if [ $? -eq 0 ]; then
unzip -o tinyuf2.zip -d .
if [ $? -ne 0 ]; then
echo "Attempt $attempt: unzip failed"
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; continue; fi
fi
break
else
echo "Attempt $attempt: wget failed to download $DOWNLOAD_URL"
if [ "$attempt" -eq 2 ]; then exit 1; else sleep 2; fi
fi
done
set -e
- name: move partition and bootloader files for tinyuf2 (to match flash_args)
run: |
# Copy files where they're expected to make flash_args happy