From b2782462d4fc626f73c5dd35863696218df4a00b Mon Sep 17 00:00:00 2001 From: Yoshiori Shoji Date: Tue, 9 Sep 2025 14:20:49 +0900 Subject: [PATCH] Upgrade deploy function --- .github/workflows/publish.yml | 12 +++---- api/build.gradle | 1 + build.gradle | 59 +++++------------------------------ client/build.gradle | 1 + service/build.gradle | 1 + 5 files changed, 16 insertions(+), 58 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9e3cb576..32af9799 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,9 +26,6 @@ jobs: needs: tagpr if: needs.tagpr.outputs.tag != '' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest - permissions: - contents: read - packages: write steps: - uses: actions/checkout@v4 - name: Set up JDK 21 @@ -40,7 +37,10 @@ jobs: uses: gradle/actions/setup-gradle@v4 - name: Test run: ./gradlew test - - name: Publish to GitHub Packages - run: ./gradlew publish + - name: Publish to Maven Central + run: ./gradlew publishAllPublicationsToMavenCentralRepository env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} diff --git a/api/build.gradle b/api/build.gradle index 481a1102..054a90ae 100644 --- a/api/build.gradle +++ b/api/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'java-library' +apply plugin: "com.vanniktech.maven.publish" dependencies { api libs.jacksonAnnotations diff --git a/build.gradle b/build.gradle index d3106554..9e659c5c 100644 --- a/build.gradle +++ b/build.gradle @@ -1,58 +1,13 @@ plugins { - id 'maven-publish' + id "com.vanniktech.maven.publish" version "0.34.0" } -subprojects { - apply plugin: 'maven-publish' - - plugins.withId('java') { - publishing { - repositories { - maven { - name = "GitHubPackages" - url = "https://maven.pkg.github.com/launchableinc/openai-java" - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - } - - publications { - maven(MavenPublication) { - from components.java - - groupId = 'com.launchableinc.openai-java' - artifactId = project.name - version = project.VERSION_NAME - - pom { - name = 'OpenAI Java Client' - description = 'Java client library for OpenAI API' - url = 'https://github.com/launchableinc/openai-java' - - licenses { - license { - name = 'The MIT License' - url = 'https://www.mit.edu/~amini/LICENSE.md' - } - } - - developers { - developer { - id = 'engineering' - name = 'Engineering' - } - } - - scm { - connection = 'scm:git:git@github.com:launchableinc/openai-java.git' - developerConnection = 'scm:git:git@github.com:launchableinc/openai-java.git' - url = 'https://github.com/launchableinc/openai-java' - } - } - } - } +allprojects { + plugins.withId("com.vanniktech.maven.publish") { + mavenPublishing { + // Publish to Maven Central via Central Portal (no authentication required for users!) + publishToMavenCentral() + signAllPublications() } } } diff --git a/client/build.gradle b/client/build.gradle index 27119649..6bc08d7d 100644 --- a/client/build.gradle +++ b/client/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'java-library' +apply plugin: "com.vanniktech.maven.publish" dependencies { api project(":api") diff --git a/service/build.gradle b/service/build.gradle index a1f95f74..e9c74932 100644 --- a/service/build.gradle +++ b/service/build.gradle @@ -1,4 +1,5 @@ apply plugin: 'java-library' +apply plugin: "com.vanniktech.maven.publish" dependencies { api project(":client")