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 53357a5
Showing 1 changed file with 40 additions and 21 deletions.
61 changes: 40 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,38 +28,57 @@ 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:
path: pylon-installer
key: pylon-installer-${{ hashFiles('pylon-installer.txt') }}
key: pylon-installer-${{ hashFiles('pylon*') }}

- name: Fetch installers
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 "pylon-installer/$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 53357a5

Please sign in to comment.