build: 修改导致curseforge推送失败的json写法
This commit is contained in:
parent
5a1c2fdbc5
commit
c05c0bdfc4
58
.github/workflows/buildAndRelease.yml
vendored
58
.github/workflows/buildAndRelease.yml
vendored
|
|
@ -130,51 +130,47 @@ jobs:
|
|||
# 从 gradle.properties 提取 curseforge_id
|
||||
CURSEFORGE_ID=$(grep "^curseforge_id=" gradle.properties | cut -d'=' -f2 || echo "")
|
||||
echo "curseforge_id=$CURSEFORGE_ID" >> $GITHUB_OUTPUT
|
||||
|
||||
# 读取 Java 版本列表
|
||||
JAVA_VERSIONS=$(grep "^java_versions=" gradle.properties | cut -d'=' -f2- || echo '[17, 21a]')
|
||||
JAVA_VERSIONS=$(echo "$JAVA_VERSIONS" | sed 's/^"//;s/"$//')
|
||||
|
||||
# Java版本 - 使用简单格式,不用JSON
|
||||
JAVA_VERSIONS=$(grep "^java_versions=" gradle.properties | cut -d'=' -f2- || echo "21,17")
|
||||
# 清理格式,移除无效字符
|
||||
JAVA_VERSIONS=$(echo "$JAVA_VERSIONS" | sed 's/\[//g; s/\]//g; s/"//g; s/ //g; s/21a/21/g' | tr -d '\r')
|
||||
echo "java_versions=$JAVA_VERSIONS" >> $GITHUB_OUTPUT
|
||||
|
||||
# 读取发布控制布尔值(默认都为 true)
|
||||
PUBLISH_GITHUB=$(grep "^publish_github=" gradle.properties | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]' || echo "true")
|
||||
PUBLISH_GITHUB=$(grep "^publish_github=" gradle.properties | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]' | tr -d ' ' || echo "true")
|
||||
if [ "$PUBLISH_GITHUB" = "true" ] || [ "$PUBLISH_GITHUB" = "1" ] || [ "$PUBLISH_GITHUB" = "yes" ]; then
|
||||
echo "publish_github=true" >> $GITHUB_OUTPUT
|
||||
echo "publish_github=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "publish_github=false" >> $GITHUB_OUTPUT
|
||||
echo "publish_github=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
PUBLISH_MODRINTH=$(grep "^publish_modrinth=" gradle.properties | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]' || echo "true")
|
||||
PUBLISH_MODRINTH=$(grep "^publish_modrinth=" gradle.properties | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]' | tr -d ' ' || echo "true")
|
||||
if [ "$PUBLISH_MODRINTH" = "true" ] || [ "$PUBLISH_MODRINTH" = "1" ] || [ "$PUBLISH_MODRINTH" = "yes" ]; then
|
||||
echo "publish_modrinth=true" >> $GITHUB_OUTPUT
|
||||
echo "publish_modrinth=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "publish_modrinth=false" >> $GITHUB_OUTPUT
|
||||
echo "publish_modrinth=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
PUBLISH_CURSEFORGE=$(grep "^publish_curseforge=" gradle.properties | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]' || echo "true")
|
||||
PUBLISH_CURSEFORGE=$(grep "^publish_curseforge=" gradle.properties | cut -d'=' -f2 | tr '[:upper:]' '[:lower:]' | tr -d ' ' || echo "true")
|
||||
if [ "$PUBLISH_CURSEFORGE" = "true" ] || [ "$PUBLISH_CURSEFORGE" = "1" ] || [ "$PUBLISH_CURSEFORGE" = "yes" ]; then
|
||||
echo "publish_curseforge=true" >> $GITHUB_OUTPUT
|
||||
echo "publish_curseforge=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "publish_curseforge=false" >> $GITHUB_OUTPUT
|
||||
echo "publish_curseforge=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
# 读取 Fabric 的 Modrinth 依赖配置
|
||||
FABRIC_MODRINTH_DEPS_RAW=$(grep "^fabric_modrinth_dependencies=" gradle.properties | cut -d'=' -f2- || echo "[]")
|
||||
FABRIC_MODRINTH_DEPS_JSON=$(echo "$FABRIC_MODRINTH_DEPS_RAW" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | tr -d '\r')
|
||||
echo "fabric_modrinth_dependencies=$FABRIC_MODRINTH_DEPS_JSON" >> $GITHUB_OUTPUT
|
||||
|
||||
# 读取 Forge 的 Modrinth 依赖配置
|
||||
FORGE_MODRINTH_DEPS_RAW=$(grep "^forge_modrinth_dependencies=" gradle.properties | cut -d'=' -f2- || echo "[]")
|
||||
FORGE_MODRINTH_DEPS_JSON=$(echo "$FORGE_MODRINTH_DEPS_RAW" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | tr -d '\r')
|
||||
echo "forge_modrinth_dependencies=$FORGE_MODRINTH_DEPS_JSON" >> $GITHUB_OUTPUT
|
||||
# 读取依赖配置 - 使用简单字符串,不用JSON
|
||||
FABRIC_MODRINTH_DEPS=$(grep "^fabric_modrinth_dependencies=" gradle.properties | cut -d'=' -f2- || echo "")
|
||||
echo "fabric_modrinth_dependencies=$FABRIC_MODRINTH_DEPS" >> $GITHUB_OUTPUT
|
||||
|
||||
# 读取 Fabric 的 CurseForge 依赖配置
|
||||
FABRIC_CURSEFORGE_DEPS_RAW=$(grep "^fabric_curseforge_dependencies=" gradle.properties | cut -d'=' -f2- || echo "[]")
|
||||
FABRIC_CURSEFORGE_DEPS_JSON=$(echo "$FABRIC_CURSEFORGE_DEPS_RAW" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | tr -d '\r')
|
||||
echo "fabric_curseforge_dependencies=$FABRIC_CURSEFORGE_DEPS_JSON" >> $GITHUB_OUTPUT
|
||||
FORGE_MODRINTH_DEPS=$(grep "^forge_modrinth_dependencies=" gradle.properties | cut -d'=' -f2- || echo "")
|
||||
echo "forge_modrinth_dependencies=$FORGE_MODRINTH_DEPS" >> $GITHUB_OUTPUT
|
||||
|
||||
# 读取 Forge 的 CurseForge 依赖配置
|
||||
FORGE_CURSEFORGE_DEPS_RAW=$(grep "^forge_curseforge_dependencies=" gradle.properties | cut -d'=' -f2- || echo "[]")
|
||||
FORGE_CURSEFORGE_DEPS_JSON=$(echo "$FORGE_CURSEFORGE_DEPS_RAW" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | tr -d '\r')
|
||||
echo "forge_curseforge_dependencies=$FORGE_CURSEFORGE_DEPS_JSON" >> $GITHUB_OUTPUT
|
||||
FABRIC_CURSEFORGE_DEPS=$(grep "^fabric_curseforge_dependencies=" gradle.properties | cut -d'=' -f2- || echo "")
|
||||
echo "fabric_curseforge_dependencies=$FABRIC_CURSEFORGE_DEPS" >> $GITHUB_OUTPUT
|
||||
|
||||
FORGE_CURSEFORGE_DEPS=$(grep "^forge_curseforge_dependencies=" gradle.properties | cut -d'=' -f2- || echo "")
|
||||
echo "forge_curseforge_dependencies=$FORGE_CURSEFORGE_DEPS" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate CZ-compliant changelog
|
||||
id: generate_changelog
|
||||
|
|
@ -373,7 +369,7 @@ jobs:
|
|||
|
||||
# Java版本
|
||||
java: |
|
||||
${{ fromJSON(steps.version_info.outputs.java_versions) }}
|
||||
${{ steps.version_info.outputs.java_versions }}
|
||||
|
||||
# Modrinth 配置
|
||||
modrinth-id: ${{ steps.version_info.outputs.modrinth_id }}
|
||||
|
|
@ -420,7 +416,7 @@ jobs:
|
|||
|
||||
# Java版本
|
||||
java: |
|
||||
${{ fromJSON(steps.version_info.outputs.java_versions) }}
|
||||
${{ steps.version_info.outputs.java_versions }}
|
||||
|
||||
# Modrinth 配置
|
||||
modrinth-id: ${{ steps.version_info.outputs.modrinth_id }}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ publish_curseforge=true
|
|||
modrinth_id=n65Vs1Vk
|
||||
curseforge_id=1445917
|
||||
|
||||
java_versions=[17,21]
|
||||
java_versions=21 17
|
||||
|
||||
fabric_modrinth_dependencies=
|
||||
forge_modrinth_dependencies=
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user