From bd668a8a2599c6258c237b9948686e44f54593b7 Mon Sep 17 00:00:00 2001 From: Roberto Cella Date: Sat, 30 May 2026 20:03:18 +0200 Subject: [PATCH 1/4] Configure retries for curl operations --- .github/actions/setup-ffmpeg/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-ffmpeg/action.yml b/.github/actions/setup-ffmpeg/action.yml index b42b2cdb..7b54e548 100644 --- a/.github/actions/setup-ffmpeg/action.yml +++ b/.github/actions/setup-ffmpeg/action.yml @@ -28,17 +28,17 @@ runs: elif [[ "${{ runner.os }}" == "macOS" ]]; then FF_VERSION=$(echo "$FF_VERSION" | awk -F. '{print $1 $2}') - curl -L "https://www.osxexperts.net/ffmpeg${FF_VERSION}arm.zip" -o ffmpeg.zip + curl -L --retry 3 --retry-delay 5 "https://www.osxexperts.net/ffmpeg${FF_VERSION}arm.zip" -o ffmpeg.zip unzip -q ffmpeg.zip mv ffmpeg "$INSTALL_DIR/ffmpeg" - curl -L "https://www.osxexperts.net/ffprobe${FF_VERSION}arm.zip" -o ffprobe.zip + curl -L --retry 3 --retry-delay 5 "https://www.osxexperts.net/ffprobe${FF_VERSION}arm.zip" -o ffprobe.zip unzip -q ffprobe.zip mv ffprobe "$INSTALL_DIR/ffprobe" chmod +x "$INSTALL_DIR/"* rm -f ffmpeg.zip ffprobe.zip elif [[ "${{ runner.os }}" == "Windows" ]]; then - curl -L "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$FF_VERSION-essentials_build.zip" -o ffmpeg.zip + curl -L --retry 3 --retry-delay 5 "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$FF_VERSION-essentials_build.zip" -o ffmpeg.zip unzip -q ffmpeg.zip find . -type f \( -name ffmpeg.exe -o -name ffprobe.exe \) -exec mv {} "$INSTALL_DIR/" \; rm -f ffmpeg.zip From e73dfad8a002fc4c0626bea56a32d747b6aac41b Mon Sep 17 00:00:00 2001 From: Roberto Cella Date: Sat, 30 May 2026 20:31:19 +0200 Subject: [PATCH 2/4] Simplify curl output --- .github/actions/setup-ffmpeg/action.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-ffmpeg/action.yml b/.github/actions/setup-ffmpeg/action.yml index 7b54e548..1e9c2cf0 100644 --- a/.github/actions/setup-ffmpeg/action.yml +++ b/.github/actions/setup-ffmpeg/action.yml @@ -28,17 +28,23 @@ runs: elif [[ "${{ runner.os }}" == "macOS" ]]; then FF_VERSION=$(echo "$FF_VERSION" | awk -F. '{print $1 $2}') - curl -L --retry 3 --retry-delay 5 "https://www.osxexperts.net/ffmpeg${FF_VERSION}arm.zip" -o ffmpeg.zip + curl -sS -L --retry 3 --retry-delay 5 \ + "https://www.osxexperts.net/ffmpeg${FF_VERSION}arm.zip" \ + -o ffmpeg.zip -w "Downloaded FFmpeg from %{url_effective}\n" unzip -q ffmpeg.zip mv ffmpeg "$INSTALL_DIR/ffmpeg" - curl -L --retry 3 --retry-delay 5 "https://www.osxexperts.net/ffprobe${FF_VERSION}arm.zip" -o ffprobe.zip + curl -sS -L --retry 3 --retry-delay 5 \ + "https://www.osxexperts.net/ffprobe${FF_VERSION}arm.zip" \ + -o ffprobe.zip -w "Downloaded FFprobe from %{url_effective}" unzip -q ffprobe.zip mv ffprobe "$INSTALL_DIR/ffprobe" chmod +x "$INSTALL_DIR/"* rm -f ffmpeg.zip ffprobe.zip elif [[ "${{ runner.os }}" == "Windows" ]]; then - curl -L --retry 3 --retry-delay 5 "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$FF_VERSION-essentials_build.zip" -o ffmpeg.zip + curl -sS -L --retry 3 --retry-delay 5 \ + "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$FF_VERSION-essentials_build.zip" \ + -o ffmpeg.zip -w "Downloaded FFmpeg and FFprobe from %{url_effective}" unzip -q ffmpeg.zip find . -type f \( -name ffmpeg.exe -o -name ffprobe.exe \) -exec mv {} "$INSTALL_DIR/" \; rm -f ffmpeg.zip From 965107f737d8afad604915f6ae690f946744d948 Mon Sep 17 00:00:00 2001 From: Roberto Cella Date: Sat, 30 May 2026 21:17:31 +0200 Subject: [PATCH 3/4] Add curl parameter to fail on http errors --- .github/actions/setup-ffmpeg/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-ffmpeg/action.yml b/.github/actions/setup-ffmpeg/action.yml index 1e9c2cf0..69d5626c 100644 --- a/.github/actions/setup-ffmpeg/action.yml +++ b/.github/actions/setup-ffmpeg/action.yml @@ -28,12 +28,12 @@ runs: elif [[ "${{ runner.os }}" == "macOS" ]]; then FF_VERSION=$(echo "$FF_VERSION" | awk -F. '{print $1 $2}') - curl -sS -L --retry 3 --retry-delay 5 \ + curl -sS -f -L --retry 3 --retry-delay 5 \ "https://www.osxexperts.net/ffmpeg${FF_VERSION}arm.zip" \ -o ffmpeg.zip -w "Downloaded FFmpeg from %{url_effective}\n" unzip -q ffmpeg.zip mv ffmpeg "$INSTALL_DIR/ffmpeg" - curl -sS -L --retry 3 --retry-delay 5 \ + curl -sS -f -L --retry 3 --retry-delay 5 \ "https://www.osxexperts.net/ffprobe${FF_VERSION}arm.zip" \ -o ffprobe.zip -w "Downloaded FFprobe from %{url_effective}" unzip -q ffprobe.zip @@ -42,7 +42,7 @@ runs: rm -f ffmpeg.zip ffprobe.zip elif [[ "${{ runner.os }}" == "Windows" ]]; then - curl -sS -L --retry 3 --retry-delay 5 \ + curl -sS -f -L --retry 3 --retry-delay 5 \ "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$FF_VERSION-essentials_build.zip" \ -o ffmpeg.zip -w "Downloaded FFmpeg and FFprobe from %{url_effective}" unzip -q ffmpeg.zip From 39e065542e0cc3855ed007b1676b0c40d7b8dc9a Mon Sep 17 00:00:00 2001 From: Roberto Cella Date: Sun, 31 May 2026 12:15:21 +0200 Subject: [PATCH 4/4] Extract binary download logic into shell function --- .github/actions/setup-ffmpeg/action.yml | 27 ++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/actions/setup-ffmpeg/action.yml b/.github/actions/setup-ffmpeg/action.yml index 69d5626c..719d4f6e 100644 --- a/.github/actions/setup-ffmpeg/action.yml +++ b/.github/actions/setup-ffmpeg/action.yml @@ -18,6 +18,16 @@ runs: echo "Installing FFmpeg and FFprobe $FF_VERSION on ${{ runner.os }}" + download_binary() { + local url="$1" + local binary_name="${2:-FFmpeg}" + local output_file="$(echo "$binary_name" | tr '[:upper:]' '[:lower:]').zip" + + curl -sS -f -L --retry 3 --retry-delay 5 "$url" -o "$output_file" -w "Downloaded $binary_name from %{url_effective}\n" + unzip -q "$output_file" + rm -f "$output_file" + } + if [[ "${{ runner.os }}" == "Linux" ]]; then docker pull mwader/static-ffmpeg:$FF_VERSION CID=$(docker create mwader/static-ffmpeg:$FF_VERSION) @@ -28,26 +38,15 @@ runs: elif [[ "${{ runner.os }}" == "macOS" ]]; then FF_VERSION=$(echo "$FF_VERSION" | awk -F. '{print $1 $2}') - curl -sS -f -L --retry 3 --retry-delay 5 \ - "https://www.osxexperts.net/ffmpeg${FF_VERSION}arm.zip" \ - -o ffmpeg.zip -w "Downloaded FFmpeg from %{url_effective}\n" - unzip -q ffmpeg.zip + download_binary "https://www.osxexperts.net/ffmpeg${FF_VERSION}arm.zip" mv ffmpeg "$INSTALL_DIR/ffmpeg" - curl -sS -f -L --retry 3 --retry-delay 5 \ - "https://www.osxexperts.net/ffprobe${FF_VERSION}arm.zip" \ - -o ffprobe.zip -w "Downloaded FFprobe from %{url_effective}" - unzip -q ffprobe.zip + download_binary "https://www.osxexperts.net/ffprobe${FF_VERSION}arm.zip" "FFprobe" mv ffprobe "$INSTALL_DIR/ffprobe" chmod +x "$INSTALL_DIR/"* - rm -f ffmpeg.zip ffprobe.zip elif [[ "${{ runner.os }}" == "Windows" ]]; then - curl -sS -f -L --retry 3 --retry-delay 5 \ - "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$FF_VERSION-essentials_build.zip" \ - -o ffmpeg.zip -w "Downloaded FFmpeg and FFprobe from %{url_effective}" - unzip -q ffmpeg.zip + download_binary "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-$FF_VERSION-essentials_build.zip" find . -type f \( -name ffmpeg.exe -o -name ffprobe.exe \) -exec mv {} "$INSTALL_DIR/" \; - rm -f ffmpeg.zip fi echo "$INSTALL_DIR" >> "$GITHUB_PATH"