details-check-generate-matrix.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. ref="${LGSM_REF:-${GITHUB_REF#refs/heads/}}"
  3. curl "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${ref}/lgsm/data/serverlist.csv" | grep -v '^[[:blank:]]*$' > serverlist.csv
  4. echo -n "{" > "shortnamearray.json"
  5. echo -n "\"include\":[" >> "shortnamearray.json"
  6. while read -r line; do
  7. shortname=$(echo "$line" | awk -F, '{ print $1 }')
  8. # If TARGETED_SHORTNAMES is set, skip servers not in the list
  9. if [ -n "${TARGETED_SHORTNAMES:-}" ]; then
  10. if ! echo "${TARGETED_SHORTNAMES}" | grep -qw "${shortname}"; then
  11. continue
  12. fi
  13. fi
  14. export shortname
  15. servername=$(echo "$line" | awk -F, '{ print $2 }')
  16. export servername
  17. gamename=$(echo "$line" | awk -F, '{ print $3 }')
  18. export gamename
  19. distro=$(echo "$line" | awk -F, '{ print $4 }')
  20. export distro
  21. # Legacy servers that require older Ubuntu/Debian versions due to glibc compatibility
  22. case "${shortname}" in
  23. bfv|bf1942)
  24. # Requires Ubuntu <= 22.04 or Debian <= 12 (glibc 2.31 compatible)
  25. runner="ubuntu-22.04"
  26. ;;
  27. btl|onset)
  28. # Requires Ubuntu <= 20.04 or Debian <= 11 (glibc 2.31 compatible)
  29. runner="ubuntu-20.04"
  30. ;;
  31. *)
  32. runner="ubuntu-latest"
  33. ;;
  34. esac
  35. {
  36. echo -n "{";
  37. echo -n "\"shortname\":";
  38. echo -n "\"${shortname}\"";
  39. echo -n ",\"runner\":";
  40. echo -n "\"${runner}\"";
  41. echo -n "},";
  42. } >> "shortnamearray.json"
  43. done < <(tail -n +2 serverlist.csv)
  44. sed -i '$ s/.$//' "shortnamearray.json"
  45. echo -n "]" >> "shortnamearray.json"
  46. echo -n "}" >> "shortnamearray.json"
  47. rm serverlist.csv