fix download as there latest branch in not weekly but nightly

This commit is contained in:
Quinten 2022-10-22 11:45:23 +02:00 committed by GitHub
parent 25b50c328b
commit e5b9f524f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@
"version": "PTDL_v2",
"update_url": null
},
"exported_at": "2022-10-22T11:26:09+02:00",
"exported_at": "2022-10-22T11:44:17+02:00",
"name": "Veloren",
"author": "parker@parkervcp.com",
"description": "Veloren is a multiplayer voxel RPG written in Rust. It is inspired by games such as Cube World, Legend of Zelda: Breath of the Wild, Dwarf Fortress and Minecraft.",
@ -22,7 +22,7 @@
},
"scripts": {
"installation": {
"script": "#!\/bin\/bash\r\n\r\napt update\r\napt install -y curl wget unzip git jq\r\n\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\nLATEST_JSON=$(curl --silent \"https:\/\/api.github.com\/repos\/veloren\/veloren\/releases\/latest\")\r\nRELEASES=$(curl --silent \"https:\/\/api.github.com\/repos\/veloren\/veloren\/releases\")\r\nARCH=$([[ \"$(uname -m)\" == \"x86_64\" ]] && echo \"linux-x86_64\" || echo \"linux-aarch64\")\r\nPART=$([[ \"$(uname -m)\" == \"x86_64\" ]] && echo \"-linux-x86_64-\" || echo \"-linux-aarch64-\")\r\nMATCH_AND_SPACES=$(echo \"weekly\" && echo ${PART} && echo ${RELEASE_DATE})\r\nMATCH=$(echo ${MATCH_AND_SPACES} | sed 's\/ \/\/g')\r\n\r\n\r\nif [ -z \"${VERSION}\" ] || [ \"${VERSION}\" == \"weekly\" ]; then\r\n echo -e \"weekly\"\r\n DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i \"${ARCH}\" | tail -n 1)\r\nelif [ \"${VERSION}\" == \"nightly\" ]; then\r\n echo -e \"nightly\"\r\n DOWNLOAD_URL=$(echo ${RELEASES} | jq -r --arg VERSION \"nightly\" '.[] | select(.tag_name==\"nightly\") | .assets[].browser_download_url' | grep -i \"${ARCH}\" | tail -n 1)\r\nelif [ \"${VERSION}\" == \"dated_weekly\" ]; then\r\n echo -e ${MATCH} \r\n DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq .assets | jq -r .[].browser_download_url | grep -i \"${MATCH}\")\r\nelse\r\n echo -e \"something went wrong\"\r\nfi\r\n\r\necho -e \"download url: ${DOWNLOAD_URL}\"\r\nwget ${DOWNLOAD_URL} -O files.zip\r\n\r\nunzip -o files.zip\r\nrm files.zip\r\n\r\nchmod +x veloren-server-cli\r\n\r\n## generate config because there is no better way to get it.\r\nmkdir -p \/mnt\/server\/userdata\/server\/server_config\/\r\nif [ ! -f \/mnt\/server\/userdata\/server\/server_config\/settings.ron ]; then\r\n wget https:\/\/raw.githubusercontent.com\/parkervcp\/eggs\/master\/game_eggs\/veloren\/settings.ron \/tmp\/settings.ron\r\n sed \"s\/14004\/${SERVER_PORT}\/g\" \/tmp\/settings.ron > \/mnt\/server\/userdata\/server\/server_config\/settings.ron\r\n rm \/tmp\/settings.ron\r\n echo \"config file pulled\"\r\nfi\r\n\r\necho -e \"install complete\"",
"script": "#!\/bin\/bash\r\n\r\napt update\r\napt install -y curl wget unzip git jq\r\n\r\nmkdir -p \/mnt\/server\r\ncd \/mnt\/server\r\n\r\nRELEASES=$(curl --silent \"https:\/\/api.github.com\/repos\/veloren\/veloren\/releases\")\r\nARCH=$([[ \"$(uname -m)\" == \"x86_64\" ]] && echo \"linux-x86_64\" || echo \"linux-aarch64\")\r\nPART=$([[ \"$(uname -m)\" == \"x86_64\" ]] && echo \"-linux-x86_64-\" || echo \"-linux-aarch64-\")\r\nMATCH_AND_SPACES=$(echo \"weekly\" && echo ${PART} && echo ${RELEASE_DATE})\r\nMATCH=$(echo ${MATCH_AND_SPACES} | sed 's\/ \/\/g')\r\n\r\n\r\nif [ -z \"${VERSION}\" ] || [ \"${VERSION}\" == \"weekly\" ]; then\r\n echo -e \"weekly\"\r\n DOWNLOAD_URL=$(echo ${RELEASES} | jq -r --arg VERSION \"weekly\" '.[] | select(.tag_name==\"weekly\") | .assets[].browser_download_url' | grep -i \"${ARCH}\" | tail -n 1)\r\nelif [ \"${VERSION}\" == \"nightly\" ]; then\r\n echo -e \"nightly\"\r\n DOWNLOAD_URL=$(echo ${RELEASES} | jq -r --arg VERSION \"nightly\" '.[] | select(.tag_name==\"nightly\") | .assets[].browser_download_url' | grep -i \"${ARCH}\" | tail -n 1)\r\nelif [ \"${VERSION}\" == \"dated_weekly\" ]; then\r\n echo -e ${MATCH} \r\n DOWNLOAD_URL=$(echo ${RELEASES} | jq -r --arg VERSION \"weekly\" '.[] | select(.tag_name==\"weekly\") | .assets[].browser_download_url' | grep -i \"${MATCH}\")\r\nelse\r\n echo -e \"something went wrong\"\r\nfi\r\n\r\necho -e \"download url: ${DOWNLOAD_URL}\"\r\nwget ${DOWNLOAD_URL} -O files.zip\r\n\r\nunzip -o files.zip\r\nrm files.zip\r\n\r\nchmod +x veloren-server-cli\r\n\r\n## generate config because there is no better way to get it.\r\nmkdir -p \/mnt\/server\/userdata\/server\/server_config\/\r\nif [ ! -f \/mnt\/server\/userdata\/server\/server_config\/settings.ron ]; then\r\n wget https:\/\/raw.githubusercontent.com\/parkervcp\/eggs\/master\/game_eggs\/veloren\/settings.ron \/tmp\/settings.ron\r\n sed \"s\/14004\/${SERVER_PORT}\/g\" \/tmp\/settings.ron > \/mnt\/server\/userdata\/server\/server_config\/settings.ron\r\n rm \/tmp\/settings.ron\r\n echo \"config file pulled\"\r\nfi\r\n\r\necho -e \"install complete\"",
"container": "debian:bullseye-slim",
"entrypoint": "bash"
}