diff --git a/.github/workflows/java-build.yml b/.github/workflows/java-build.yml index 7a7f87e..39554db 100644 --- a/.github/workflows/java-build.yml +++ b/.github/workflows/java-build.yml @@ -44,6 +44,12 @@ jobs: - validation - tagging runs-on: ubuntu-latest + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralUsername }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_mavenCentralPassword }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyId }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKeyPassword }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_signingInMemoryKey }} steps: - uses: actions/checkout@v4 - name: Checkout proto repository diff --git a/.gitignore b/.gitignore index 5485c35..ba3e05f 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ proto-repo/ .DS_Store /src/ +/test.env diff --git a/README.md b/README.md index bc456f8..851856a 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,7 @@ applications. ## Requirements - Java 21 or later -- Github account -- Gradle +- Gradle or Maven ## Installation @@ -19,30 +18,22 @@ applications. Add the following configuration to your `build.gradle` file: ```kts -repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/KodyPay/kody-clientsdk-java-dev/") - credentials { - username = System.getenv("GITHUB_USERNAME") - password = System.getenv("GITHUB_TOKEN") - } - } -} - dependencies { - implementation("com.kodypay.api.grpc:kody-clientsdk-java:0.0.1") + implementation("com.kodypay.grpc:kody-clientsdk-java:0.0.1") } ``` -To authenticate with GitHub Packages, you need to create a personal access token with the `read:packages` scope and set it as an environment variable: +### Maven -```bash -export GITHUB_USERNAME= -export GITHUB_TOKEN= -``` +Add the following configuration to your `pom.xml` file: -Refer to the [GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) for more information about the token. +```xml + + com.kodypay.grpc + kody-clientsdk-java + 0.0.1 + +``` ## Samples diff --git a/build.gradle.kts b/build.gradle.kts index 9176bc5..b42d339 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,17 +1,17 @@ import com.google.protobuf.gradle.* +import com.vanniktech.maven.publish.SonatypeHost plugins { id("java-library") id("com.google.protobuf") version "0.9.4" - id("maven-publish") id("nebula.release") version "19.0.10" + id("com.vanniktech.maven.publish") version "0.28.0" } description = "Kody Java gRPC Client" -group = "com.kodypay.api.grpc" +group = "com.kodypay.grpc" val protobufVersion = "4.27.3" -val semverVersion = "0.9.0" val grpcVersion = "1.66.0" val annotationsVersion = "6.0.53" @@ -59,21 +59,32 @@ protobuf { } } -publishing { - publications { - create("gpr") { - from(components["java"]) +mavenPublishing { + pom { + name = "kody-clientsdk-java" + description = "Kody Java gRPC Client" + url = "https://github.com/KodyPay/kody-clientsdk-java" + inceptionYear = "2024" + licenses{ + license { + name = "MIT License" + url = "https://opensource.org/licenses/MIT" + } } - } - repositories { - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/${System.getenv("GITHUB_REPOSITORY")}") - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") + developers { + developer { + id = "kodypay" + name = "Kody" } } + scm { + url = "https://github.com/KodyPay/kody-clientsdk-java" + connection = "scm:git:git://github.com/KodyPay/kody-clientsdk-java.git" + developerConnection = "scm:git:ssh://github.com/KodyPay/kody-clientsdk-java.git" + } + + signAllPublications() + publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) } } diff --git a/samples/build.gradle.kts b/samples/build.gradle.kts index 9e48d99..ae0cab3 100644 --- a/samples/build.gradle.kts +++ b/samples/build.gradle.kts @@ -13,14 +13,6 @@ repositories { mavenCentral() google() gradlePluginPortal() - maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/KodyPay/kody-clientsdk-java/") - credentials { - username = System.getenv("GITHUB_USERNAME") - password = System.getenv("GITHUB_TOKEN") - } - } } @@ -38,6 +30,6 @@ dependencies { implementation("com.google.protobuf:protobuf-java:$protobufVersion") implementation("org.apache.logging.log4j:log4j-slf4j2-impl:$log4jVersion") implementation("org.apache.commons:commons-lang3:$apacheCommonsVersion") - implementation("com.kodypay.api.grpc:kody-clientsdk-java:0.0.1") + implementation("com.kodypay.grpc:kody-clientsdk-java:0.0.1") }