Skip to content

Commit

Permalink
readded release build path
Browse files Browse the repository at this point in the history
  • Loading branch information
quiqueck committed Dec 4, 2021
1 parent 0a16054 commit c0b461d
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions bclib.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,58 @@ artifacts {
archives javadocJar
}

def env = System.getenv()

import org.kohsuke.github.GHReleaseBuilder
import org.kohsuke.github.GitHub

task release(dependsOn: [remapJar, sourcesJar, javadocJar]) {
onlyIf {
env.GITHUB_TOKEN
}

doLast {
def github = GitHub.connectUsingOAuth(env.GITHUB_TOKEN as String)
def repository = github.getRepository("paulevsGitch/BCLib")

def releaseBuilder = new GHReleaseBuilder(repository, version as String)
releaseBuilder.name("${archivesBaseName}-${version}")
releaseBuilder.body("A changelog can be found at https://github.com/paulevsGitch/BCLib/commits")
releaseBuilder.commitish("main")

def ghRelease = releaseBuilder.create()
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}.jar"), "application/java-archive");
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}-sources.jar"), "application/java-archive");
ghRelease.uploadAsset(file("${project.buildDir}/libs/${archivesBaseName}-${version}-javadoc.jar"), "application/java-archive");
}
}

// configure the maven publication
publishing {
publications {
gpr(MavenPublication) {
artifactId archivesBaseName
artifact(remapJar) {
builtBy remapJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
}
}

// select the repositories you want to publish to
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/paulevsgitch/bclib")
credentials {
username = env.GITHUB_USER
password = env.GITHUB_TOKEN
}
}
}
}

configurations {
dev {
Expand Down

0 comments on commit c0b461d

Please sign in to comment.