Updated Modrinth modpacks to use VERSION and support id, name, or number for project version (#2130)

This commit is contained in:
Geoff Bourne 2023-05-15 18:23:43 -05:00 committed by GitHub
parent 54f310e50f
commit cd63fc882a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 11 deletions

View File

@ -46,7 +46,7 @@ RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
--var version=0.1.1 --var app=maven-metadata-release --file {{.app}} \
--from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
ARG MC_HELPER_VERSION=1.28.2
ARG MC_HELPER_VERSION=1.28.3
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
# used for cache busting local copy of mc-image-helper
ARG MC_HELPER_REV=1

View File

@ -607,11 +607,15 @@ The desired modpack project is specified with the `MODRINTH_PROJECT` environment
![](docs/modrinth-project-id.drawio.png)
- The project page URL, such as <https://modrinth.com/modpack/cobblemon-fabric>. As described below, this can further be the page URL of a modpack's version page.
By default, the latest available version of the Modrinth modpack is selected based upon the value of `MODRINTH_DEFAULT_VERSION_TYPE`, which defaults to "release". Other valid values are "beta" and "alpha".
The automatic modpack version resolving can be narrowed in a few ways:
The selected version can also be narrowed by a few means: If wanting to use a particular mod loader, set `MODRINTH_LOADER` to either "forge" or "fabric" (Quilt support is coming soon). Since the overall `VERSION` gets dictated by the modpack, a specific modpack Minecraft version can be specified by setting `MODRINTH_MC_VERSION` to a valid version, such as "1.19.2".
The latest release or beta version, respectively, of the Modrinth modpack is selected when `VERSION` is "LATEST" or "SNAPSHOT". That can be overridden by setting `MODRINTH_DEFAULT_VERSION_TYPE` to "release", "beta", or "alpha".
A specific version of modpack file can be specified by passing the version's page URL to `MODRINTH_PROJECT`, such as <https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2> or by setting `MODRINTH_VERSION_ID` to the version ID located in the Metadata section, as shown here
Furthermore, the resolved modpack version can be narrowed by setting `VERSION` to a specific Minecraft version, such as "1.19.2".
The selected version can also be narrowed to a particular mod loader by setting `MODRINTH_LOADER` to either "forge" or "fabric" (Quilt support is coming soon).
Instead of auto resolving, a specific version of modpack file can be specified by passing the version's page URL to `MODRINTH_PROJECT`, such as <https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2> or by setting `MODRINTH_VERSION` to the version ID or number located in the Metadata section, as shown here
![](docs/modrinth-version-id.drawio.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

After

Width:  |  Height:  |  Size: 128 KiB

View File

@ -11,10 +11,14 @@ services:
EULA: "TRUE"
TYPE: MODRINTH
MODRINTH_PROJECT: https://modrinth.com/modpack/cobblemon-fabric/version/1.3.2
# or could be https://modrinth.com/modpack/cobblemon-fabric for auto-upgrading to latest
# or for auto-upgrading to latest
# MODRINTH_PROJECT: https://modrinth.com/modpack/cobblemon-fabric
# or just cobblemon-fabric or 5FFgwNNP
# and could replace version URL with
# MODRINTH_VERSION_ID: nvrqJg44
# MODRINTH_VERSION: nvrqJg44
# MODRINTH_VERSION: 1.3.2
# MODRINTH_VERSION: "Cobblemon [Fabric] 1.3.2"
SETUP_ONLY: "true"
volumes:
# attach the relative directory 'data' to the container's /data path
- ./data:/data

View File

@ -7,10 +7,8 @@ set -eu
resultsFile=/data/.install-modrinth.env
requireVar MODRINTH_PROJECT
: "${MODRINTH_MC_VERSION:=}"
: "${MODRINTH_LOADER:=}"
: "${MODRINTH_VERSION_ID:=}"
: "${MODRINTH_DEFAULT_VERSION_TYPE:=release}"
: "${MODRINTH_VERSION:=${MODRINTH_VERSION_ID:-}}"
isDebugging && set -x
@ -20,6 +18,19 @@ args=(
--output-directory=/data
)
case "${VERSION^^}" in
LATEST)
: "${MODRINTH_DEFAULT_VERSION_TYPE:=release}"
;;
SNAPSHOT)
: "${MODRINTH_DEFAULT_VERSION_TYPE:=beta}"
;;
*)
: "${MODRINTH_DEFAULT_VERSION_TYPE:=release}"
args+=("--game-version=$VERSION")
;;
esac
setArg() {
arg="${1?}"
var="${2?}"
@ -28,9 +39,8 @@ setArg() {
args+=("${arg}=${!var}")
fi
}
setArg --game-version MODRINTH_MC_VERSION
setArg --loader MODRINTH_LOADER
setArg --version-id MODRINTH_VERSION_ID
setArg --version MODRINTH_VERSION
setArg --default-version-type MODRINTH_DEFAULT_VERSION_TYPE
if ! mc-image-helper install-modrinth-modpack "${args[@]}"; then