Skip to content

Commit

Permalink
switch to com.github.breadmoirai.github-release for release publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolij committed May 17, 2024
1 parent b15caa2 commit 39152b1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
cache-read-only: true
- name: :release
run: ./gradlew release -Prelease_channel=RELEASE
run: ./gradlew githubRelease -Prelease_channel=RELEASE
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GRGIT_USER: ${{ secrets.GITHUB_TOKEN }}
31 changes: 15 additions & 16 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ plugins {
id("java")
id("maven-publish")
id("org.ajoberstar.grgit")
id("com.github.breadmoirai.github-release")
}

operator fun String.invoke(): String = rootProject.properties[this] as? String ?: error("Property $this not found")
Expand Down Expand Up @@ -77,8 +78,11 @@ if (releaseChannel.suffix != null) {
patchAndSuffix += "-${releaseChannel.suffix}"
}

version = "${minorVersion}.${patchAndSuffix}"
println("ZSON Version: $version")
val versionString = "${minorVersion}.${patchAndSuffix}"
val versionTagName = "${releaseTagPrefix}/${versionString}"

version = versionString
println("ZSON Version: $versionString")

repositories {
mavenCentral()
Expand Down Expand Up @@ -136,21 +140,16 @@ tasks.withType<JavaCompile> {
}
}

val release by tasks.registering {
group = "publishing"
githubRelease {
setToken(providers.environmentVariable("GITHUB_TOKEN"))
setTagName(versionTagName)
setTargetCommitish("master")
setReleaseName(versionString)
setReleaseAssets(tasks.jar.get().archiveFile, sourcesJar.get().archiveFile)
}

tasks.githubRelease {
dependsOn(tasks.assemble, tasks.check)

doLast {
val tagName = "${releaseTagPrefix}/${version}"
val tag = grgit.tag.add {
name = tagName
pointsTo = grgit.head()
}

grgit.push {
refsOrSpecs = listOf(tag.fullName)
}
}
}

publishing {
Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pluginManagement {
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version("0.7.0")
id("org.ajoberstar.grgit") version("5.2.2") apply(false)
id("com.github.breadmoirai.github-release") version("2.4.1") apply(false)
}

rootProject.name = "zson"
Expand Down

0 comments on commit 39152b1

Please sign in to comment.