Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,21 @@ jobs:
cfg = json.loads(pathlib.Path("curseforge.json").read_text(encoding="utf-8"))
print(f"CF_PROJECT_ID={cfg['projectId']}")
print(f"CF_GAME_ENDPOINT={cfg['gameEndpoint']}")
print(f"CF_API_BASE_URL={cfg.get('apiBaseUrl', f\"https://{cfg['gameEndpoint']}.curseforge.com\")}")
print(f"CF_RELEASE_TYPE={cfg.get('releaseType', 'release')}")
print(f"CF_CHANGELOG_TYPE={cfg.get('changelogType', 'markdown')}")
print("CF_GAME_VERSIONS=" + ",".join(str(v) for v in cfg["gameVersions"]))
relations = cfg.get("relations")
if relations is not None:
print("CF_RELATIONS_JSON=" + json.dumps(relations, separators=(",", ":")))
PY

- name: Build CurseForge zip
shell: bash
run: |
set -euo pipefail
ZIP_PATH="build/libs/bumenfeld-clock-${{ github.ref_name }}.zip"
zip -j "$ZIP_PATH" "$CF_FILE_PATH" "LICENSE" "USAGE.md"
zip -j "$ZIP_PATH" "$CF_FILE_PATH" "LICENSE" "USAGE.md" "build/resources/main/manifest.json"
echo "CF_ZIP_PATH=$ZIP_PATH" >> "$GITHUB_ENV"

- name: Upload to CurseForge (Upload API)
Expand All @@ -91,15 +95,20 @@ jobs:
"gameVersions": [int(v) for v in os.environ["CF_GAME_VERSIONS"].split(",") if v],
"releaseType": os.environ.get("CF_RELEASE_TYPE", "release"),
}
pathlib.Path("build/cf-metadata.json").write_text(json.dumps(metadata), encoding="utf-8")
relations_json = os.environ.get("CF_RELATIONS_JSON")
if relations_json:
metadata["relations"] = json.loads(relations_json)
pathlib.Path("build/cf-metadata.json").write_text(json.dumps(metadata, separators=(",", ":")), encoding="utf-8")
PY
METADATA_JSON="$(cat build/cf-metadata.json)"
echo "Metadata JSON: ${METADATA_JSON}"
HTTP_CODE="$(curl -sS -L --fail-with-body \
-o build/cf-upload-response.json \
-D build/cf-upload-headers.txt \
-w "%{http_code}" \
-X POST "https://${CF_GAME_ENDPOINT}.curseforge.com/api/projects/${CF_PROJECT_ID}/upload-file" \
-X POST "${CF_API_BASE_URL}/api/projects/${CF_PROJECT_ID}/upload-file" \
-H "X-Api-Token: $CF_API_TOKEN" \
-F "metadata=@build/cf-metadata.json;type=application/json" \
-F "metadata=<build/cf-metadata.json;type=application/json" \
-F "file=@${CF_ZIP_PATH}")"
echo "CurseForge upload HTTP status: $HTTP_CODE"
echo "CurseForge upload response headers:"
Expand Down
11 changes: 10 additions & 1 deletion curseforge.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
{
"projectId": "1452160",
"gameEndpoint": "hytale",
"apiBaseUrl": "https://www.curseforge.com",
"gameVersions": [14284],
"releaseType": "release",
"changelogType": "markdown"
"changelogType": "markdown",
"relations": {
"projects": [
{
"projectID": 1423634,
"type": "requiredDependency"
}
]
}
}