From 0d6a348578bfd72f975f86a2b1a4228a5215f912 Mon Sep 17 00:00:00 2001 From: littlecodedragon <253116839+littlecodedragon@users.noreply.github.com> Date: Fri, 8 May 2026 07:11:00 +0200 Subject: [PATCH] CI: ensure curl is available in Forgejo release steps --- .forgejo/workflows/build_release.yml | 52 ++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/.forgejo/workflows/build_release.yml b/.forgejo/workflows/build_release.yml index e04aa70cc..847a3fd13 100755 --- a/.forgejo/workflows/build_release.yml +++ b/.forgejo/workflows/build_release.yml @@ -315,7 +315,33 @@ jobs: fi discover_jq } + ensure_curl() { + if command -v curl >/dev/null 2>&1; then + return 0 + fi + run_as_root() { + if [ "$(id -u)" -eq 0 ]; then + "$@" + elif command -v sudo >/dev/null 2>&1; then + sudo "$@" + else + return 1 + fi + } + if command -v dnf >/dev/null 2>&1; then + run_as_root dnf install -y curl + elif command -v apt-get >/dev/null 2>&1; then + run_as_root apt-get update + run_as_root apt-get install -y curl + elif command -v apk >/dev/null 2>&1; then + run_as_root apk add --no-cache curl + elif command -v pacman >/dev/null 2>&1; then + run_as_root pacman -Sy --noconfirm curl + fi + command -v curl >/dev/null 2>&1 + } ensure_jq || { echo "jq not found; install jq on the runner (dnf install -y jq)."; exit 1; } + ensure_curl || { echo "curl not found; install curl on the runner (dnf install -y curl)."; exit 1; } api_base="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases" payload_file="$(mktemp)" @@ -437,7 +463,33 @@ jobs: fi discover_jq } + ensure_curl() { + if command -v curl >/dev/null 2>&1; then + return 0 + fi + run_as_root() { + if [ "$(id -u)" -eq 0 ]; then + "$@" + elif command -v sudo >/dev/null 2>&1; then + sudo "$@" + else + return 1 + fi + } + if command -v dnf >/dev/null 2>&1; then + run_as_root dnf install -y curl + elif command -v apt-get >/dev/null 2>&1; then + run_as_root apt-get update + run_as_root apt-get install -y curl + elif command -v apk >/dev/null 2>&1; then + run_as_root apk add --no-cache curl + elif command -v pacman >/dev/null 2>&1; then + run_as_root pacman -Sy --noconfirm curl + fi + command -v curl >/dev/null 2>&1 + } ensure_jq || { echo "jq not found; install jq on the runner (dnf install -y jq)."; exit 1; } + ensure_curl || { echo "curl not found; install curl on the runner (dnf install -y curl)."; exit 1; } release_api="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" assets_file="$(mktemp)"