Harden JDK package-manager detection in Forgejo release job.
Some checks failed
Forgejo Release Builder / release (push) Failing after 23m19s

Log PATH and package manager probes, check common absolute binary locations, and keep workflow free of control bytes for Forgejo parsing.
This commit is contained in:
littlecodedragon 2026-04-27 06:41:24 +02:00
parent fc6b46b07b
commit acca36c3a3

View file

@ -46,14 +46,16 @@ jobs:
if command -v java >/dev/null 2>&1; then
java -version
else
if command -v dnf >/dev/null 2>&1; then
echo "PATH=$PATH"
echo "pkg managers: dnf=$(command -v dnf || true) apt=$(command -v apt-get || true) apk=$(command -v apk || true) pacman=$(command -v pacman || true)"
if [ -x /usr/bin/dnf ] || command -v dnf >/dev/null 2>&1; then
pkg_install dnf install -y java-17-openjdk-devel
elif command -v apt-get >/dev/null 2>&1; then
elif [ -x /usr/bin/apt-get ] || command -v apt-get >/dev/null 2>&1; then
pkg_install apt-get update
pkg_install apt-get install -y openjdk-17-jdk
elif command -v apk >/dev/null 2>&1; then
elif [ -x /sbin/apk ] || [ -x /usr/sbin/apk ] || command -v apk >/dev/null 2>&1; then
pkg_install apk add --no-cache openjdk17
elif command -v pacman >/dev/null 2>&1; then
elif [ -x /usr/bin/pacman ] || command -v pacman >/dev/null 2>&1; then
pkg_install pacman -Sy --noconfirm jdk17-openjdk
else
echo "No supported package manager found for JDK installation."