From 5df35778fe1c436f318368e17da2bd4889759fba Mon Sep 17 00:00:00 2001 From: Greg Schueler Date: Sun, 1 Mar 2020 15:45:05 -0800 Subject: [PATCH] Set up bintray publishing --- .github/workflows/publish-github.yml | 8 +-- build.gradle | 85 ++++++++++++++++++++++++++-- gradle/java.gradle | 30 ---------- gradle/publishing.gradle | 43 -------------- 4 files changed, 84 insertions(+), 82 deletions(-) delete mode 100644 gradle/java.gradle delete mode 100644 gradle/publishing.gradle diff --git a/.github/workflows/publish-github.yml b/.github/workflows/publish-github.yml index 4b798b0..ba6139f 100644 --- a/.github/workflows/publish-github.yml +++ b/.github/workflows/publish-github.yml @@ -22,9 +22,9 @@ jobs: run: VERSION=$(./gradlew currentVersion | grep 'version:' | cut -d ' ' -f 3) && echo ::set-output name=VERSION::$VERSION - name: Build with Gradle run: ./gradlew build - - name: Publish to Github - run: ./gradlew publish + - name: Publish to Bintray + run: ./gradlew -PbintrayUser=gschueler -PbintrayOrg=rundeck -PbintrayRepo=maven -PdryRun=false bintrayUpload env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_USER: gschueler + BINTRAY_TOKEN: ${{ secrets.BINTRAY_TOKEN }} + BINTRAY_USER: gschueler diff --git a/build.gradle b/build.gradle index f267494..9241819 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,12 @@ +buildscript{ + dependencies { + classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4' + } +} plugins { id 'pl.allegro.tech.build.axion-release' version '1.4.1' + id 'idea' } - scmVersion { tag { prefix = '' @@ -16,12 +21,82 @@ allprojects { subprojects{ apply plugin: 'java-library' apply plugin: 'maven-publish' - apply from: "${rootDir}/gradle/java.gradle" - apply from: "${rootDir}/gradle/publishing.gradle" + apply plugin: 'com.jfrog.bintray' + + + java { + withJavadocJar() + withSourcesJar() + } + + javadoc { + if (JavaVersion.current().isJava8Compatible()) { + options.addStringOption('Xdoclint:none', '-quiet') + } + if(JavaVersion.current().isJava9Compatible()) { + options.addBooleanOption('html5', true) + } + } + + publishing { + publications { + "${project.name}Lib"(MavenPublication) { + from components.java + version = project.version + pom { + name = "Rundeck CLI Toolbelt - ${project.name}" + description = "CLI utility - ${project.name}" + url = 'https://github.com/rundeck/cli-toolbelt' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'gschueler' + name = 'Greg Schueler' + email = 'greg@rundeck.com' + } + } + scm { + connection = 'scm:git:git://github.com/rundeck/cli-toolbelt.git' + developerConnection = 'scm:git:ssh://github.com/rundeck/cli-toolbelt.git' + url = 'https://github.com/rundeck/cli-toolbelt' + } + } + } + } + + bintray { + user = findProperty("bintrayUser") + key = System.getenv("BINTRAY_TOKEN") + + dryRun = (findProperty('dryRun') ?: 'true').toBoolean() + delegate.publish = true + publications = ["${project.name}Lib"] + pkg { + repo = findProperty('bintrayRepo') + name = 'cli-' + project.name + userOrg = findProperty('bintrayOrg') + licenses = ['Apache-2.0'] + githubRepo = 'rundeck/cli-toolbelt' //Optional Github repository + vcsUrl = 'https://github.com/rundeck/cli-toolbelt.git' + + version { + name = project.version +// mavenCentralSync { +// sync = true //[Default: true] Determines whether to sync the version to Maven Central. +// user = findProperty('ossUser') //OSS user token: mandatory +// password = System.getenv("OSS_PASSWORD") //OSS user password: mandatory +// } + } + } + } + } } -apply plugin: 'idea' -defaultTasks 'clean', 'build' repositories { mavenCentral() diff --git a/gradle/java.gradle b/gradle/java.gradle deleted file mode 100644 index 57cc43a..0000000 --- a/gradle/java.gradle +++ /dev/null @@ -1,30 +0,0 @@ -// produce a jar file for our test classes -task testJar(type: Jar) { - classifier = 'tests' - from sourceSets.test.java -} - -// produce a jar file for our source files -task sourceJar(type: Jar) { - classifier = 'sources' - from sourceSets.main.java -} - -// produce a jar file for our javadoc -task javadocJar(type: Jar, dependsOn: javadoc) { - classifier = 'javadoc' - from javadoc.destinationDir -} - -if (JavaVersion.current().isJava8Compatible()) { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } -} - -//add all artifacts to archives -artifacts { - archives testJar - archives sourceJar - archives javadocJar -} \ No newline at end of file diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle deleted file mode 100644 index 40659e2..0000000 --- a/gradle/publishing.gradle +++ /dev/null @@ -1,43 +0,0 @@ -publishing { - - repositories { - maven { - name = 'GitHubPackages' - url = "https://maven.pkg.github.com/rundeck/cli-toolbelt" - credentials { - username = System.getenv("GH_USER") - password = System.getenv("GH_TOKEN") - } - } - } - - publications { - "${project.name}Lib"(MavenPublication) { - from components.java - pom { - name = "Rundeck CLI Toolbelt - ${project.name}" - description = "CLI utility - ${project.name}" - url = 'https://github.com/rundeck/cli-toolbelt' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - } - } - developers { - developer { - id = 'gschueler' - name = 'Greg Schueler' - email = 'greg@rundeck.com' - } - } - scm { - connection = 'scm:git:git://github.com/rundeck/cli-toolbelt.git' - developerConnection = 'scm:git:ssh://github.com/rundeck/cli-toolbelt.git' - url = 'https://github.com/rundeck/cli-toolbelt' - } - } - } - } - -}