details-check-generate-matrix.sh 849 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. curl "https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/${GITHUB_REF#refs/heads/}/lgsm/data/serverlist.csv" | grep -v '^[[:blank:]]*$' > serverlist.csv
  3. echo -n "{" > "shortnamearray.json"
  4. echo -n "\"include\":[" >> "shortnamearray.json"
  5. while read -r line; do
  6. shortname=$(echo "$line" | awk -F, '{ print $1 }')
  7. export shortname
  8. servername=$(echo "$line" | awk -F, '{ print $2 }')
  9. export servername
  10. gamename=$(echo "$line" | awk -F, '{ print $3 }')
  11. export gamename
  12. distro=$(echo "$line" | awk -F, '{ print $4 }')
  13. export distro
  14. {
  15. echo -n "{";
  16. echo -n "\"shortname\":";
  17. echo -n "\"${shortname}\"";
  18. echo -n "},";
  19. } >> "shortnamearray.json"
  20. done < <(tail -n +2 serverlist.csv)
  21. sed -i '$ s/.$//' "shortnamearray.json"
  22. echo -n "]" >> "shortnamearray.json"
  23. echo -n "}" >> "shortnamearray.json"
  24. rm serverlist.csv