Commit 2fb73e89 by Jonathan Thomas

Adding FORGE deployment to both Modrinth and CurseForge deploy scripts.

parent 30ec9b36
Pipeline #12729 passed with stages
in 2 minutes 22 seconds
...@@ -11,6 +11,7 @@ All notable changes to **CreatureChat** are documented in this file. The format ...@@ -11,6 +11,7 @@ All notable changes to **CreatureChat** are documented in this file. The format
- Best friends are now rideable! Right click with an empty hand. Excludes tameable entities (dogs, cats, etc...) - Best friends are now rideable! Right click with an empty hand. Excludes tameable entities (dogs, cats, etc...)
- Villager trades are now affected by friendship! Be nice! - Villager trades are now affected by friendship! Be nice!
- Automatically tame best friends (who are tameable) and un-tame worst enemies! - Automatically tame best friends (who are tameable) and un-tame worst enemies!
- Added FORGE deployment into automated deploy script
### Changed ### Changed
- Improved character creation with more random classes, speaking styles, and alignments. - Improved character creation with more random classes, speaking styles, and alignments.
......
...@@ -6,7 +6,6 @@ CURSEFORGE_API_KEY=${CURSEFORGE_API_KEY} ...@@ -6,7 +6,6 @@ CURSEFORGE_API_KEY=${CURSEFORGE_API_KEY}
CHANGELOG_FILE="./CHANGELOG.md" CHANGELOG_FILE="./CHANGELOG.md"
API_URL="https://minecraft.curseforge.com/api" API_URL="https://minecraft.curseforge.com/api"
PROJECT_ID=1012118 PROJECT_ID=1012118
DEPENDENCY_SLUG="fabric-api"
USER_AGENT="CreatureChat-Minecraft-Mod:curseforge@owlmaddie.com" USER_AGENT="CreatureChat-Minecraft-Mod:curseforge@owlmaddie.com"
SLEEP_DURATION=5 SLEEP_DURATION=5
...@@ -57,13 +56,14 @@ fetch_game_version_ids() { ...@@ -57,13 +56,14 @@ fetch_game_version_ids() {
local client_id=$(echo "$response" | jq -r '.[] | select(.name == "Client") | .id') local client_id=$(echo "$response" | jq -r '.[] | select(.name == "Client") | .id')
local server_id=$(echo "$response" | jq -r '.[] | select(.name == "Server") | .id') local server_id=$(echo "$response" | jq -r '.[] | select(.name == "Server") | .id')
local fabric_id=$(echo "$response" | jq -r '.[] | select(.name == "Fabric") | .id') local fabric_id=$(echo "$response" | jq -r '.[] | select(.name == "Fabric") | .id')
local forge_id=$(echo "$response" | jq -r '.[] | select(.name == "Forge") | .id')
if [ -z "$client_id" ] || [ -z "$server_id" ] || [ -z "$fabric_id" ]; then if [ -z "$client_id" ] || [ -z "$server_id" ] || ([ -z "$fabric_id" ] && [ -z "$forge_id" ]); then
echo "ERROR: One or more game version IDs not found." echo "ERROR: One or more game version IDs not found."
exit 1 exit 1
fi fi
echo "$client_id $server_id $fabric_id $minecraft_id" echo "$client_id $server_id $fabric_id $forge_id $minecraft_id"
} }
# Read the first changelog block # Read the first changelog block
...@@ -107,7 +107,19 @@ for FILE in creaturechat*.jar; do ...@@ -107,7 +107,19 @@ for FILE in creaturechat*.jar; do
# DEBUG # DEBUG
echo "Minecraft Type ID: $GAME_TYPE_ID" echo "Minecraft Type ID: $GAME_TYPE_ID"
echo "Minecraft Versions IDs (client_id: ${GAME_VERSION_IDS[0]}, server_id: ${GAME_VERSION_IDS[1]}, fabric_id: ${GAME_VERSION_IDS[2]}, minecraft_id: ${GAME_VERSION_IDS[3]})" echo "Minecraft Versions IDs (client_id: ${GAME_VERSION_IDS[0]}, server_id: ${GAME_VERSION_IDS[1]}, fabric_id: ${GAME_VERSION_IDS[2]}, forge_id: ${GAME_VERSION_IDS[3]}, minecraft_id: ${GAME_VERSION_IDS[4]})"
# Determine the dependency slugs and loader ID based on the file name
if [[ "$FILE_BASENAME" == *"-forge.jar" ]]; then
DEPENDENCY_SLUGS=("sinytra-connector" "forgified-fabric-api")
LOADER_ID="${GAME_VERSION_IDS[3]}"
else
DEPENDENCY_SLUGS=("fabric-api")
LOADER_ID="${GAME_VERSION_IDS[2]}"
fi
# Create dependencies array for payload
RELATIONS=$(for slug in "${DEPENDENCY_SLUGS[@]}"; do jq -n --arg slug "$slug" '{"slug": $slug, "type": "requiredDependency"}'; done | jq -s .)
# Create a new version payload # Create a new version payload
PAYLOAD=$(jq -n --arg changelog "$CHANGELOG" \ PAYLOAD=$(jq -n --arg changelog "$CHANGELOG" \
...@@ -116,7 +128,7 @@ for FILE in creaturechat*.jar; do ...@@ -116,7 +128,7 @@ for FILE in creaturechat*.jar; do
--argjson gameVersions "$(printf '%s\n' "${GAME_VERSION_IDS[@]}" | jq -R . | jq -s .)" \ --argjson gameVersions "$(printf '%s\n' "${GAME_VERSION_IDS[@]}" | jq -R . | jq -s .)" \
--argjson gameVersionTypeIds "[$GAME_TYPE_ID]" \ --argjson gameVersionTypeIds "[$GAME_TYPE_ID]" \
--arg releaseType "release" \ --arg releaseType "release" \
--argjson relations '[{"slug": "'"$DEPENDENCY_SLUG"'", "type": "requiredDependency"}]' \ --argjson relations "$RELATIONS" \
'{ '{
"changelog": $changelog, "changelog": $changelog,
"changelogType": $changelogType, "changelogType": $changelogType,
......
...@@ -43,6 +43,15 @@ for FILE in creaturechat*.jar; do ...@@ -43,6 +43,15 @@ for FILE in creaturechat*.jar; do
exit 1 exit 1
fi fi
# Determine the loaders and dependencies based on the file name
if [[ "$FILE_BASENAME" == *"-forge.jar" ]]; then
LOADERS='["forge"]'
DEPENDENCIES='[{"project_id": "u58R1TMW", "dependency_type": "required"}, {"project_id": "Aqlf1Shp", "dependency_type": "required"}]'
else
LOADERS='["fabric"]'
DEPENDENCIES='[{"project_id": "P7dR8mSH", "dependency_type": "required"}]'
fi
# Check if the version already exists # Check if the version already exists
echo "Checking if version $VERSION_NUMBER already exists on Modrinth..." echo "Checking if version $VERSION_NUMBER already exists on Modrinth..."
if curl --retry 3 --retry-delay 5 --silent --fail -X GET "$API_URL/project/creaturechat/version/$VERSION_NUMBER" > /dev/null 2>&1; then if curl --retry 3 --retry-delay 5 --silent --fail -X GET "$API_URL/project/creaturechat/version/$VERSION_NUMBER" > /dev/null 2>&1; then
...@@ -59,9 +68,9 @@ for FILE in creaturechat*.jar; do ...@@ -59,9 +68,9 @@ for FILE in creaturechat*.jar; do
# Create a new version payload # Create a new version payload
PAYLOAD=$(jq -n --arg version_number "$VERSION_NUMBER" \ PAYLOAD=$(jq -n --arg version_number "$VERSION_NUMBER" \
--arg changelog "$CHANGELOG" \ --arg changelog "$CHANGELOG" \
--argjson dependencies '[{"project_id": "P7dR8mSH", "dependency_type": "required"}]' \ --argjson dependencies "$DEPENDENCIES" \
--argjson game_versions '["'"$MINECRAFT_VERSION"'"]' \ --argjson game_versions '["'"$MINECRAFT_VERSION"'"]' \
--argjson loaders '["fabric"]' \ --argjson loaders "$LOADERS" \
--arg project_id "$PROJECT_ID" \ --arg project_id "$PROJECT_ID" \
--arg name "CreatureChat $VERSION_NUMBER" \ --arg name "CreatureChat $VERSION_NUMBER" \
--argjson file_parts '["file"]' \ --argjson file_parts '["file"]' \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment