Skip to content
BreadMoirai edited this page Aug 1, 2021 · 4 revisions

Recipes

Minimal configuration

githubRelease {
  token getProperty('github.token')
  FilenameFilter filter = { dir, filename -> filename.contains(project.version) }
  releaseAssets = jar.destinationDir.listFiles filter 
}

Splitting the release process into multiple tasks

import com.github.breadmoirai.githubreleaseplugin.GithubReleaseTask

task githubCreateRelease(type: GithubReleaseTask) {
    body {
        "## Changelog\n" +
            changelog {
                executable "C:\\Program Files\\Git\\bin\\git.exe"
                lastCommit 'db6b295'
            }.call().readLines().each {
                "- $it"
            }.join('\n')
    }
    draft = true
}

task githubUploadTestFiles(type: GithubReleaseTask) {
    dependsOn githubCreateRelease
    allowUploadToExisting true
    releaseAssets(files("test1.txt", "test2.txt"))
    draft = true
}

tasks.githubRelease {
    dependsOn githubUploadTestFiles
    draft = false
}

tasks.withType(GithubReleaseTask) {
    owner 'BreadMoirai'
    repo 'TestRepo'
    token project.findProperty('github.token') ?: ''
}

Mutliple Release Tasks

task githubRelease(type: GithubReleaseTask) {
    ....
}

task otherGithubRelease(type: GithubReleaseTask) {
   ....
}