Skip to content

Commit

Permalink
Add GitHub release integration without files
Browse files Browse the repository at this point in the history
  • Loading branch information
Kotori316 committed Aug 28, 2024
1 parent ed36868 commit 00bdbfe
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
import java.time.ZoneId
import java.time.ZonedDateTime
import java.time.format.DateTimeFormatter

plugins {
alias(libs.plugins.idea.ext)
alias(libs.plugins.github.release)
}

val changelog: Provider<String> = provider {
val time = ZonedDateTime.now(ZoneId.of("Asia/Tokyo")).withNano(0).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)
val fromFile = project.file(project.property("changelog_file")!!).readText()
val shortFormat = fromFile.split(Regex("^# ", RegexOption.MULTILINE), limit = 3)[1]
"""
QuarryPlus for Minecraft ${libs.versions.minecraft.get()}
Released at $time
| Name | Version |
| -- | -- |
| Minecraft | ${libs.versions.minecraft.get()} |
| Forge | ${libs.versions.forge.get()} |
| Fabric | ${libs.versions.fabric.api.get()} |
| NeoForge | ${libs.versions.neoforge.get()} |
""".trimIndent() + System.lineSeparator() + shortFormat
}

githubRelease {
owner = "Kotori316"
repo = "QuarryPlus"
token(project.findProperty("githubToken") as? String ?: System.getenv("REPO_TOKEN") ?: "")
targetCommitish = project.property("mod.branch") as String
tagName = provider { "v${project.project(":common").version}" }
releaseName = provider { "v${project.project(":common").version} for Minecraft ${libs.versions.minecraft.get()}" }
prerelease = false
body = changelog
dryRun = (System.getenv("RELEASE_DEBUG") ?: "true").toBoolean()
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
changelog_file=changelog/1.21.md
mod.branch=1.21
parchment.minecraft=1.21
parchment.mapping=2024.07.28
# https://docs.gradle.org/current/userguide/upgrading_version_8.html#xml_parsing_now_requires_recent_parsers
Expand Down

0 comments on commit 00bdbfe

Please sign in to comment.