-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fetch latest and recommended instead of api and minecraft
- Loading branch information
1 parent
4743d89
commit eded644
Showing
6 changed files
with
19 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
minecraft_versions=( | ||
1.20.2 | ||
1.20.1 | ||
1.19.4 | ||
1.19.3 | ||
1.19.2 | ||
1.18.2 | ||
1.17.1 | ||
1.16.5 | ||
) | ||
set -euo pipefail | ||
|
||
api_versions=( | ||
11 | ||
|
@@ -20,30 +11,31 @@ api_versions=( | |
|
||
fetch_versions() { | ||
local kind="${1?no kind!}" | ||
shift 1 | ||
local recommended="${2?no recommended flag!}" | ||
shift 2 | ||
for v in "$@" | ||
do | ||
curl -s "https://dl-api.spongepowered.org/v2/groups/org.spongepowered/artifacts/spongevanilla/versions?tags=${kind}:${v}&offset=0&limit=1" \ | ||
| jq --arg version "$v" -Mc '{key: $version, value: .artifacts | to_entries | first | .key}' | ||
curl -s "https://dl-api.spongepowered.org/v2/groups/org.spongepowered/artifacts/spongevanilla/versions?tags=${kind}:${v}&recommended=${recommended}&offset=0&limit=1" \ | ||
| jq --arg version "$v" -Mc '{key: $version, value: (.artifacts // {}) | to_entries | first | .key}' | ||
done | ||
} | ||
|
||
transform_to_versions() { | ||
jq -s 'sort_by(.key) | from_entries' | ||
jq -s 'sort_by(.key) | map(select(.value != null)) | from_entries' | ||
} | ||
|
||
versions_file="$(mktemp)" | ||
|
||
minecraft_versions_file="minecraft-versions.json" | ||
api_versions_file="api-versions.json" | ||
latest_versions_file="latest-versions.json" | ||
recommended_versions_file="recommended-versions.json" | ||
|
||
fetch_versions "minecraft" "${minecraft_versions[@]}" | transform_to_versions > "$minecraft_versions_file" | ||
fetch_versions "api" "${api_versions[@]}" | transform_to_versions > "$api_versions_file" | ||
fetch_versions "api" false "${api_versions[@]}" | transform_to_versions > "$latest_versions_file" | ||
fetch_versions "api" true "${api_versions[@]}" | transform_to_versions > "$recommended_versions_file" | ||
|
||
git config user.name 'CubeEngine Sponge Updater' | ||
git config user.email '[email protected]' | ||
|
||
git add "$minecraft_versions_file" "$api_versions_file" | ||
git add "$latest_versions_file" "$recommended_versions_file" | ||
|
||
if git commit -m 'My hands are typing words....' | ||
then | ||
|
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"8": "1.16.5-8.2.0" | ||
} |