diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index f6f764d..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Publish Artifacts - -on: - release: - types: [published] - -jobs: - publish: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Publish Artifacts - run: ./gradlew api:bintrayUpload client:bintrayUpload -DlibraryVersion=${GITHUB_REF##*/} - env: - BINTRAY_USER : ${{ secrets.BINTRAY_USER }} - BINTRAY_KEY : ${{ secrets.BINTRAY_KEY }} diff --git a/.gitignore b/.gitignore index ff142ad..88b001b 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,6 @@ hs_err_pid* # Ignore Gradle build output directory build + +# ignore secrets in gradle.properties +gradle.properties diff --git a/api/build.gradle b/api/build.gradle index 89f9809..ef7e2d0 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'java-library' -apply plugin: 'com.jfrog.bintray' -apply plugin: 'maven-publish' +apply plugin: 'maven' +apply plugin: 'signing' dependencies { compileOnly 'org.projectlombok:lombok:1.18.12' @@ -13,6 +13,7 @@ ext { version = libraryVersion group = 'com.theokanning.openai-gpt3-java' +archivesBaseName = "api" task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' @@ -24,18 +25,32 @@ task javadocJar(type: Jar, dependsOn: javadoc) { from javadoc.destinationDir } -publishing { - publications { - ApiPublication(MavenPublication) { - from components.java - artifact sourcesJar - artifact javadocJar - groupId project.group - artifactId 'api' - version libraryVersion - pom { - description = 'POJOs for the OpenAI GPT-3 API' +artifacts { + archives javadocJar, sourcesJar +} + +signing { + sign configurations.archives +} + +uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + pom.project { name = 'api' + packaging 'jar' + + description = 'POJOs for the OpenAI GPT-3 API' url = 'https://github.com/theokanning/openai-java' developers { developer { @@ -45,6 +60,8 @@ publishing { } } scm { + connection "https://github.com/theokanning/openai-java.git" + developerConnection "https://github.com/theokanning/openai-java.git" url = "https://github.com/theokanning/openai-java" } licenses { @@ -58,20 +75,3 @@ publishing { } } } - -bintray { - user = System.getenv("BINTRAY_USER") - key = System.getenv("BINTRAY_KEY") - - publications = ['ApiPublication'] - pkg { - repo = 'openai-gpt3-java' - name = 'api' - vcsUrl = 'https://github.com/TheoKanning/openai-java.git' - licenses = ["MIT"] - publish = false - version { - name = libraryVersion - } - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 1abc4d9..25e6e2f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,14 +1,11 @@ buildscript { repositories { - jcenter() - } - dependencies { - classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4" + mavenCentral() } } allprojects { repositories { - jcenter() + mavenCentral() } -} \ No newline at end of file +} diff --git a/client/build.gradle b/client/build.gradle index 0cb11b8..f21df91 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'java-library' -apply plugin: 'com.jfrog.bintray' -apply plugin: 'maven-publish' +apply plugin: 'maven' +apply plugin: 'signing' dependencies { api project(":api") @@ -15,6 +15,7 @@ ext { version = libraryVersion group = 'com.theokanning.openai-gpt3-java' +archivesBaseName = "client" task sourcesJar(type: Jar, dependsOn: classes) { classifier = 'sources' @@ -26,18 +27,32 @@ task javadocJar(type: Jar, dependsOn: javadoc) { from javadoc.destinationDir } -publishing { - publications { - ClientPublication(MavenPublication) { - from components.java - artifact sourcesJar - artifact javadocJar - groupId project.group - artifactId 'client' - version libraryVersion - pom { - description = 'Basic retrofit client for OpenAI\'s GPT-3 API' +artifacts { + archives javadocJar, sourcesJar +} + +signing { + sign configurations.archives +} + +uploadArchives { + repositories { + mavenDeployer { + beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } + + repository(url: "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + snapshotRepository(url: "https://s01.oss.sonatype.org/content/repositories/snapshots/") { + authentication(userName: ossrhUsername, password: ossrhPassword) + } + + pom.project { name = 'client' + packaging 'jar' + + description = 'Basic retrofit client for OpenAI\'s GPT-3 API' url = 'https://github.com/theokanning/openai-java' developers { developer { @@ -47,6 +62,8 @@ publishing { } } scm { + connection "https://github.com/theokanning/openai-java.git" + developerConnection "https://github.com/theokanning/openai-java.git" url = "https://github.com/theokanning/openai-java" } licenses { @@ -60,20 +77,3 @@ publishing { } } } - -bintray { - user = System.getenv("BINTRAY_USER") - key = System.getenv("BINTRAY_KEY") - - publications = ['ClientPublication'] - pkg { - repo = 'openai-gpt3-java' - name = 'client' - vcsUrl = 'https://github.com/TheoKanning/openai-java.git' - licenses = ["MIT"] - publish = false - version { - name = libraryVersion - } - } -} \ No newline at end of file