diff --git a/README.md b/README.md index 2e779d6a..404e1347 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ +[![](https://jitpack.io/v/paulevsGitch/BCLib.svg)](https://jitpack.io/#paulevsGitch/BCLib) # BCLib BCLib is a library mod for BetterX team mods, developed for Fabric, MC 1.16.4+ diff --git a/build.gradle b/build.gradle index c1e57588..7c36bc4c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,12 @@ -import java.util.function.BiConsumer +buildscript { + dependencies { + classpath 'org.kohsuke:github-api:1.114' + } +} plugins { + id 'idea' + id 'eclipse' id 'fabric-loom' version '0.7-SNAPSHOT' id 'maven-publish' } @@ -77,12 +83,8 @@ tasks.withType(JavaCompile) { options.encoding = "UTF-8" } -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task -// if it is present. -// If you remove this task, sources will not be generated. -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource +javadoc { + options.tags = [ "reason" ] } task javadocJar(type: Jar, dependsOn: javadoc) { @@ -90,6 +92,14 @@ task javadocJar(type: Jar, dependsOn: javadoc) { from javadoc.destinationDir } +// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task +// if it is present. +// If you remove this task, sources will not be generated. +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + jar { from "LICENSE" } @@ -101,6 +111,30 @@ artifacts { def env = System.getenv() +import org.kohsuke.github.GHReleaseBuilder +import org.kohsuke.github.GitHub + +task github(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 {