From cea4a2faf5dfe007c1a1e153624cdd6038361eaa Mon Sep 17 00:00:00 2001 From: Integer Limit <103940576+IntegerLimit@users.noreply.github.com> Date: Sat, 13 Jul 2024 13:09:20 +1000 Subject: [PATCH] Log and Send to Step Summary CurseForge Uploaded File IDs (#97) --- build.gradle | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/build.gradle b/build.gradle index 09eec4b..c005f03 100644 --- a/build.gradle +++ b/build.gradle @@ -1237,6 +1237,30 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) { additionalFile.changelog = changelogRaw } } + doLast { + // No File IDs in Debug Mode + if (!deploymentDebug.toBoolean()) { + def list = [] + for (def artifact : tasks.curseforge.getUploadArtifacts()) { + list.add(artifact) + for (def additionalArtifact : artifact.getAdditionalArtifacts()) { + list.add(additionalArtifact) + } + } + def summary = "## CurseForge Build Summary (Mod ${modName} | Project ID ${curseForgeProjectId})" + for (def artifact : list) { + def fileId = artifact.getCurseFileId() + def fileName = artifact.getArtifact().getSingleFile().name + println("Uploaded File ${fileName}, With File ID: ${fileId}") + summary = summary + "\n - File: ${fileName} | File ID: ${fileId}" + } + println(summary) + def stepSummary = providers.environmentVariable("GITHUB_STEP_SUMMARY") + if (stepSummary.isPresent()) { + file(stepSummary.get()).write(summary) + } + } + } } tasks.curseforge.dependsOn(build) tasks.curseforge.dependsOn('generateChangelog')