Skip to content

Commit 7fe7b3f

Browse files
committed
build: add retry logic for musl cross-compiler download in release workflow
1 parent 23d3cf3 commit 7fe7b3f

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,30 @@ jobs:
6969
sudo apt-get install -y musl-tools
7070
if [ "${{ matrix.target }}" = "aarch64-unknown-linux-musl" ]; then
7171
sudo apt-get install -y gcc-aarch64-linux-gnu musl-dev
72-
# Install aarch64 musl cross-compiler
73-
curl -fsSL https://musl.cc/aarch64-linux-musl-cross.tgz | sudo tar xz -C /opt
72+
# Install aarch64 musl cross-compiler with retry and fallback mirrors
73+
MUSL_ARCHIVE="aarch64-linux-musl-cross.tgz"
74+
MUSL_URLS=(
75+
"https://more.musl.cc/x86_64-linux-musl/${MUSL_ARCHIVE}"
76+
"https://musl.cc/${MUSL_ARCHIVE}"
77+
)
78+
DOWNLOADED=false
79+
for url in "${MUSL_URLS[@]}"; do
80+
echo "Trying: ${url}"
81+
for attempt in 1 2 3; do
82+
echo " Attempt ${attempt}..."
83+
if curl -fsSL --connect-timeout 30 --retry 2 --retry-delay 5 -o "/tmp/${MUSL_ARCHIVE}" "${url}"; then
84+
DOWNLOADED=true
85+
break 2
86+
fi
87+
sleep 5
88+
done
89+
done
90+
if [ "${DOWNLOADED}" = false ]; then
91+
echo "::error::Failed to download musl cross-compiler from all mirrors"
92+
exit 1
93+
fi
94+
sudo tar xzf "/tmp/${MUSL_ARCHIVE}" -C /opt
95+
rm -f "/tmp/${MUSL_ARCHIVE}"
7496
echo "/opt/aarch64-linux-musl-cross/bin" >> $GITHUB_PATH
7597
fi
7698

0 commit comments

Comments
 (0)