Skip to content

Commit

Permalink
Update update_Flash2MQTT.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
all-solutions authored Oct 14, 2024
1 parent 9d3c403 commit f7da308
Showing 1 changed file with 32 additions and 40 deletions.
72 changes: 32 additions & 40 deletions .github/workflows/update_Flash2MQTT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,15 @@ jobs:
echo "Determining total number of desired variants..."
while read file; do
echo "Processing file: $file"
if [[ "$file" == *"_${version}.bin" ]]; then
echo "File matches current release version."
variant_part=$(echo "$file" | sed -E 's/^'"$FIRMWARE_NAME"'_//; s/_'"${version}"'\.bin$//')
variant_name="${variant_part%%_*}" # Extract the base variant name
echo "Extracted variant_name: $variant_name"
if [[ "$variant_name" == "d1_mini" || "$variant_name" == "esp01" ]]; then
echo "Variant $variant_name is desired. Incrementing total."
total=$((total + 1))
else
echo "Variant $variant_name is not desired."
fi
# Extract variant name
variant_part=$(echo "$file" | sed -E 's/^'"$FIRMWARE_NAME"'_//; s/(_'"${version}"')?\.bin$//')
variant_name="${variant_part%%_*}" # Extract the base variant name
echo "Extracted variant_name: $variant_name"
if [[ "$variant_name" == "d1_mini" || "$variant_name" == "esp01" ]]; then
echo "Variant $variant_name is desired. Incrementing total."
total=$((total + 1))
else
echo "File does not match current release version."
echo "Variant $variant_name is not desired."
fi
done < bin_files.txt
echo "Total desired variants: $total"
Expand All @@ -112,35 +108,31 @@ jobs:
echo "Building variants.json..."
while read file; do
echo "Processing file: $file"
if [[ "$file" == *"_${version}.bin" ]]; then
echo "File matches current release version."
variant_part=$(echo "$file" | sed -E 's/^'"$FIRMWARE_NAME"'_//; s/_'"${version}"'\.bin$//')
variant_name="${variant_part%%_*}" # Extract the base variant name
echo "Extracted variant_name: $variant_name"
case "$variant_name" in
"d1_mini")
display_name="D1 Mini"
;;
"esp01")
display_name="ESP-01"
;;
*)
echo "Variant $variant_name is not desired. Skipping."
continue
;;
esac
count=$((count + 1))
echo "Adding variant $display_name to variants.json."
echo ' {' >> variants.json
echo ' "displayName": "'"$display_name"'",' >> variants.json
echo ' "file": "https://all-solutions.github.io/Flash2MQTT/firmware/'"$FIRMWARE_NAME"'/'"$file"'"' >> variants.json
if [ $count -lt $total ]; then
echo ' },' >> variants.json
else
echo ' }' >> variants.json
fi
# Extract variant name
variant_part=$(echo "$file" | sed -E 's/^'"$FIRMWARE_NAME"'_//; s/(_'"${version}"')?\.bin$//')
variant_name="${variant_part%%_*}" # Extract the base variant name
echo "Extracted variant_name: $variant_name"
case "$variant_name" in
"d1_mini")
display_name="D1 Mini"
;;
"esp01")
display_name="ESP-01"
;;
*)
echo "Variant $variant_name is not desired. Skipping."
continue
;;
esac
count=$((count + 1))
echo "Adding variant $display_name to variants.json."
echo ' {' >> variants.json
echo ' "displayName": "'"$display_name"'",' >> variants.json
echo ' "file": "https://all-solutions.github.io/Flash2MQTT/firmware/'"$FIRMWARE_NAME"'/'"$file"'"' >> variants.json
if [ $count -lt $total ]; then
echo ' },' >> variants.json
else
echo "File does not match current release version."
echo ' }' >> variants.json
fi
done < bin_files.txt
echo ']' >> variants.json
Expand Down

0 comments on commit f7da308

Please sign in to comment.