Resolve latest Paper version when no published builds (#1555)
This commit is contained in:
parent
b1be888dd4
commit
9458005b5b
|
@ -34,19 +34,19 @@ jobs:
|
|||
# jammy doesn't work until minecraft updates to https://github.com/netty/netty/issues/12343
|
||||
baseImage: eclipse-temurin:17-jre-focal
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
mcVersion: LATEST
|
||||
mcVersion: 1.18.2
|
||||
- variant: java17-jdk
|
||||
baseImage: eclipse-temurin:17-focal
|
||||
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||
mcVersion: LATEST
|
||||
mcVersion: 1.18.2
|
||||
- variant: java17-openj9
|
||||
baseImage: ibm-semeru-runtimes:open-17-jre
|
||||
platforms: linux/amd64,linux/arm64
|
||||
mcVersion: LATEST
|
||||
mcVersion: 1.18.2
|
||||
- variant: java17-alpine
|
||||
baseImage: eclipse-temurin:17-jre-alpine
|
||||
platforms: linux/amd64
|
||||
mcVersion: LATEST
|
||||
mcVersion: 1.18.2
|
||||
# JAVA 11:
|
||||
- variant: java11
|
||||
baseImage: adoptopenjdk:11-jre-hotspot
|
||||
|
|
|
@ -34,7 +34,7 @@ jobs:
|
|||
- name: Run tests
|
||||
env:
|
||||
MODS_FORGEAPI_KEY: ${{ secrets.MODS_FORGEAPI_KEY }}
|
||||
MINECRAFT_VERSION: LATEST
|
||||
MINECRAFT_VERSION: 1.18.2
|
||||
run: |
|
||||
tests/test.sh
|
||||
push:
|
||||
|
|
|
@ -4,6 +4,30 @@
|
|||
set -o pipefail
|
||||
isDebugging && set -x
|
||||
|
||||
ourScript="$0"
|
||||
ourArgs=("$@")
|
||||
|
||||
function handleMissingVersion() {
|
||||
expectedVersion=${VANILLA_VERSION}
|
||||
versions=$(curl -fsSL "https://papermc.io/api/v2/projects/paper" -H "accept: application/json")
|
||||
if [[ $VERSION = LATEST ]]; then
|
||||
tries=0
|
||||
while ((tries++ < 5)); do
|
||||
VANILLA_VERSION=$(echo "$versions" | jq -r ".versions[$((- tries))]")
|
||||
if [[ $(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \
|
||||
| jq '.builds[-1]') != null ]]; then
|
||||
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC"
|
||||
# re-execute the current script with the newly computed version
|
||||
exec "$ourScript" "${ourArgs[@]}"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
log "ERROR: ${expectedVersion} is not published by PaperMC"
|
||||
log " Set VERSION to one of the following: "
|
||||
log " $(echo "$versions" | jq -r '.versions | join(", ")')"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if [[ $PAPER_DOWNLOAD_URL ]]; then
|
||||
export SERVER=$(getFilenameFromUrl "${PAPER_DOWNLOAD_URL}")
|
||||
|
||||
|
@ -23,26 +47,16 @@ else
|
|||
0)
|
||||
;;
|
||||
22)
|
||||
versions=$(curl -fsSL "https://papermc.io/api/v2/projects/paper" -H "accept: application/json")
|
||||
if [[ $VERSION = LATEST ]]; then
|
||||
VANILLA_VERSION=$(echo "$versions" | jq -r '.versions[-1]')
|
||||
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC"
|
||||
# re-execute the current script with the newly computed version
|
||||
exec "$0" "$@"
|
||||
fi
|
||||
log "ERROR: ${VANILLA_VERSION} is not published by PaperMC"
|
||||
log " Set VERSION to one of the following: "
|
||||
log " $(echo "$versions" | jq -r '.versions | join(", ")')"
|
||||
exit 1
|
||||
handleMissingVersion
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unknown error while looking up PaperMC version=${VANILLA_VERSION}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
if [ $? != 0 ]; then
|
||||
echo "ERROR: failed to lookup PaperMC build from version ${VANILLA_VERSION}"
|
||||
exit 1
|
||||
|
||||
if [[ $build = null ]]; then
|
||||
handleMissingVersion
|
||||
fi
|
||||
|
||||
export SERVER=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}" -H "accept: application/json" \
|
||||
|
|
|
@ -13,7 +13,7 @@ services:
|
|||
# Using family to test FORGEAPI Family filter.
|
||||
FAMILY: FABRIC
|
||||
CUSTOM_SERVER: /servers/fake.jar
|
||||
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||
VERSION: 1.18.2
|
||||
MODS_FORGEAPI_FILE: /config/forgeapi_mods.json
|
||||
# Key is defined in .github/workflows/pr.yml and ci.yml
|
||||
# This should be coming from github secrets.
|
||||
|
|
|
@ -13,7 +13,7 @@ services:
|
|||
# Using family to test FORGEAPI Family filter.
|
||||
FAMILY: FABRIC
|
||||
CUSTOM_SERVER: /servers/fake.jar
|
||||
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||
VERSION: 1.18.2
|
||||
# Validate Skip Gametype Filter:
|
||||
MODS_FORGEAPI_IGNORE_GAMETYPE: "TRUE"
|
||||
# Validates that Biomes does not download terrablender
|
||||
|
|
|
@ -13,7 +13,7 @@ services:
|
|||
# - Currently we do not support filtering on vanilla.
|
||||
FAMILY: VANILLA
|
||||
CUSTOM_SERVER: /servers/fake.jar
|
||||
VERSION: ${MINECRAFT_VERSION:-LATEST}
|
||||
VERSION: 1.18.2
|
||||
MODS_FORGEAPI_DOWNLOAD_DEPENDENCIES: "TRUE"
|
||||
# Contains mix of Forge and Fabric mods
|
||||
MODS_FORGEAPI_PROJECTIDS: 416089,419697
|
||||
|
|
Loading…
Reference in New Issue