Skip to content

Commit cea4a2f

Browse files
authored
Log and Send to Step Summary CurseForge Uploaded File IDs (#97)
1 parent adb0821 commit cea4a2f

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

build.gradle

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,6 +1237,30 @@ if (cfApiKey.isPresent() || deploymentDebug.toBoolean()) {
12371237
additionalFile.changelog = changelogRaw
12381238
}
12391239
}
1240+
doLast {
1241+
// No File IDs in Debug Mode
1242+
if (!deploymentDebug.toBoolean()) {
1243+
def list = []
1244+
for (def artifact : tasks.curseforge.getUploadArtifacts()) {
1245+
list.add(artifact)
1246+
for (def additionalArtifact : artifact.getAdditionalArtifacts()) {
1247+
list.add(additionalArtifact)
1248+
}
1249+
}
1250+
def summary = "## CurseForge Build Summary (Mod ${modName} | Project ID ${curseForgeProjectId})"
1251+
for (def artifact : list) {
1252+
def fileId = artifact.getCurseFileId()
1253+
def fileName = artifact.getArtifact().getSingleFile().name
1254+
println("Uploaded File ${fileName}, With File ID: ${fileId}")
1255+
summary = summary + "\n - File: ${fileName} | File ID: ${fileId}"
1256+
}
1257+
println(summary)
1258+
def stepSummary = providers.environmentVariable("GITHUB_STEP_SUMMARY")
1259+
if (stepSummary.isPresent()) {
1260+
file(stepSummary.get()).write(summary)
1261+
}
1262+
}
1263+
}
12401264
}
12411265
tasks.curseforge.dependsOn(build)
12421266
tasks.curseforge.dependsOn('generateChangelog')

0 commit comments

Comments
 (0)