diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 286c7d6..85e44a2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: @@ -47,19 +38,47 @@ 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 + mkdir pylon-installer + cd pylon-installer + 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