Skip to content

Commit

Permalink
download pylon using optional URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
thiesmoeller committed Feb 27, 2024
1 parent d0e6136 commit cb58dc5
Showing 1 changed file with 37 additions and 19 deletions.
56 changes: 37 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ jobs:
outputs:
is_release_build: ${{ env.RELEASE_BUILD == '1' }}
steps:
- name: Installer list
run: |
tee pylon-installer.txt <<"EOF"
${PYLON_DOWNLOAD_URL_BASE_7_4}pylon_7.4.0.14900_linux_x86_64_setup.tar.gz
${PYLON_DOWNLOAD_URL_BASE_7_4}pylon_7.4.0.14900_linux_aarch64_setup.tar.gz
${PYLON_DOWNLOAD_URL_BASE}pylon_6.2.0.21487_armhf_setup.tar.gz
${PYLON_DOWNLOAD_URL_BASE}pylon_7_3_1_0011.dmg
${PYLON_DOWNLOAD_URL_BASE}basler_pylon_7_4_0_14900.exe
EOF
- uses: actions/cache@v3
id: cache
with:
Expand All @@ -47,19 +38,46 @@ jobs:
if: steps.cache.outputs.cache-hit != 'true'
env:
PYLON_DOWNLOAD_URL_BASE: ${{ secrets.PYLON_DOWNLOAD_URL_BASE }}
PYLON_DOWNLOAD_URL_BASE_6_2: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_6_2 }}
PYLON_DOWNLOAD_URL_BASE_6_3: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_6_3 }}
PYLON_DOWNLOAD_URL_BASE_7_4: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_7_4 }}
PYLON_DOWNLOAD_ARM64_URL_BASE: ${{ secrets.PYLON_DOWNLOAD_ARM64_URL_BASE }}
run: |
mkdir pylon-installer && cd pylon-installer
while read line; do
url=$(eval echo "$line")
echo "download $url"
curl -sSfL -O "$url"
done <../pylon-installer.txt
echo "Download result"
ls -l
URLS=(
"${PYLON_DOWNLOAD_URL_BASE_7_4}pylon-7.4.0.14900_linux-x86_64_setup.tar.gz ${PYLON_DOWNLOAD_URL_BASE_7_4}pylon_7.4.0.14900_linux_x86_64_setup.tar.gz "
"${PYLON_DOWNLOAD_URL_BASE_7_4}pylon_7_4_0_14900_linux_aarch64_setup.tar.gz ${PYLON_DOWNLOAD_URL_BASE_7_4}pylon-7.4.0.14900_linux-aarch64_setup.tar.gz"
"${PYLON_DOWNLOAD_URL_BASE}pylon_6.2.0.21487_armhf_setup.tar.gz ${PYLON_DOWNLOAD_URL_BASE}pylon-6.2.0.21487-armhf_setup.tar.gz"
"${PYLON_DOWNLOAD_URL_BASE}pylon_7_3_1_0011.dmg"
"${PYLON_DOWNLOAD_URL_BASE}basler_pylon_7_4_0_14900.exe"
)
download_file() {
local url="$1"
local filename="${url##*/}"
wget -q "$url" -O "$filename"
if [ $? -ne 0 ]; then
echo "Error downloading $filename"
return 1
fi
}
# Iterate through the list of possible download URLs
for sublist in "${URLS[@]}"; do
success=false
# Split the sublist into individual URLs
read -ra urls <<< "$sublist"
for url in "${urls[@]}"; do
download_file "$url"
if [ $? -eq 0 ]; then
echo "Downloaded $url"
success=true
break # Successfully downloaded, move to the next sublist
fi
done
if [ "$success" = false ]; then
echo "None of the URLs were successfully downloaded."
exit 1
fi
done
echo "All files downloaded successfully!"
md5sum *
- uses: actions/upload-artifact@v3
Expand Down

0 comments on commit cb58dc5

Please sign in to comment.