Skip to content

Commit 53357a5

Browse files
committed
download pylon using optional URLs
1 parent d0e6136 commit 53357a5

File tree

1 file changed

+40
-21
lines changed

1 file changed

+40
-21
lines changed

.github/workflows/main.yml

Lines changed: 40 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,57 @@ jobs:
2828
outputs:
2929
is_release_build: ${{ env.RELEASE_BUILD == '1' }}
3030
steps:
31-
- name: Installer list
32-
run: |
33-
tee pylon-installer.txt <<"EOF"
34-
${PYLON_DOWNLOAD_URL_BASE_7_4}pylon_7.4.0.14900_linux_x86_64_setup.tar.gz
35-
${PYLON_DOWNLOAD_URL_BASE_7_4}pylon_7.4.0.14900_linux_aarch64_setup.tar.gz
36-
${PYLON_DOWNLOAD_URL_BASE}pylon_6.2.0.21487_armhf_setup.tar.gz
37-
${PYLON_DOWNLOAD_URL_BASE}pylon_7_3_1_0011.dmg
38-
${PYLON_DOWNLOAD_URL_BASE}basler_pylon_7_4_0_14900.exe
39-
EOF
4031
- uses: actions/cache@v3
4132
id: cache
4233
with:
4334
path: pylon-installer
44-
key: pylon-installer-${{ hashFiles('pylon-installer.txt') }}
35+
key: pylon-installer-${{ hashFiles('pylon*') }}
4536

4637
- name: Fetch installers
4738
if: steps.cache.outputs.cache-hit != 'true'
4839
env:
4940
PYLON_DOWNLOAD_URL_BASE: ${{ secrets.PYLON_DOWNLOAD_URL_BASE }}
50-
PYLON_DOWNLOAD_URL_BASE_6_2: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_6_2 }}
51-
PYLON_DOWNLOAD_URL_BASE_6_3: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_6_3 }}
5241
PYLON_DOWNLOAD_URL_BASE_7_4: ${{ secrets.PYLON_DOWNLOAD_URL_BASE_7_4 }}
53-
PYLON_DOWNLOAD_ARM64_URL_BASE: ${{ secrets.PYLON_DOWNLOAD_ARM64_URL_BASE }}
5442
run: |
55-
mkdir pylon-installer && cd pylon-installer
56-
while read line; do
57-
url=$(eval echo "$line")
58-
echo "download $url"
59-
curl -sSfL -O "$url"
60-
done <../pylon-installer.txt
61-
echo "Download result"
62-
ls -l
43+
mkdir pylon-installer
44+
cd pylon-installer
45+
URLS=(
46+
"${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 "
47+
"${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"
48+
"${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"
49+
"${PYLON_DOWNLOAD_URL_BASE}pylon_7_3_1_0011.dmg"
50+
"${PYLON_DOWNLOAD_URL_BASE}basler_pylon_7_4_0_14900.exe"
51+
)
52+
53+
download_file() {
54+
local url="$1"
55+
local filename="${url##*/}"
56+
wget -q "$url" -O "pylon-installer/$filename"
57+
if [ $? -ne 0 ]; then
58+
echo "Error downloading $filename"
59+
return 1
60+
fi
61+
}
62+
63+
# Iterate through the list of possible download URLs
64+
for sublist in "${URLS[@]}"; do
65+
success=false
66+
# Split the sublist into individual URLs
67+
read -ra urls <<< "$sublist"
68+
for url in "${urls[@]}"; do
69+
download_file "$url"
70+
if [ $? -eq 0 ]; then
71+
echo "Downloaded $url"
72+
success=true
73+
break # Successfully downloaded, move to the next sublist
74+
fi
75+
done
76+
if [ "$success" = false ]; then
77+
echo "None of the URLs were successfully downloaded."
78+
exit 1
79+
fi
80+
done
81+
echo "All files downloaded successfully!"
6382
md5sum *
6483
6584
- uses: actions/upload-artifact@v3

0 commit comments

Comments
 (0)