diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fc0c1ae7..a974d284 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,7 +29,7 @@ jobs: run: ./gradlew test - name: Publish package - run: ./gradlew publish + run: ./gradlew publishToSonatype closeStagingRepositories env: PGP_SIGNING_KEY: ${{ secrets.PGP_SIGNING_KEY }} PGP_SIGNING_PASSWORD: ${{ secrets.PGP_SIGNING_PASSWORD }} diff --git a/build.gradle b/build.gradle index 68270f83..6718709d 100644 --- a/build.gradle +++ b/build.gradle @@ -6,6 +6,7 @@ apply plugin: 'io.github.goooler.shadow' apply plugin: 'com.github.ben-manes.versions' apply plugin: 'jacoco' apply plugin: 'org.sonarqube' +apply plugin: 'io.github.gradle-nexus.publish-plugin' group 'co.omise' version '5.2.0' @@ -31,6 +32,7 @@ buildscript { classpath "io.github.goooler.shadow:shadow-gradle-plugin:8.1.8" classpath 'com.github.ben-manes:gradle-versions-plugin:0.42.0' classpath("org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:5.1.0.4882") + classpath "io.github.gradle-nexus:publish-plugin:2.0.0" } } @@ -111,18 +113,6 @@ publishing { } } } - - repositories { - maven { - def releasesRepoUrl = 'https://oss.sonatype.org/service/local/staging/deploy/maven2/' - def snapshotsRepoUrl = 'https://oss.sonatype.org/content/repositories/snapshots' - url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl - credentials { - username = System.getenv("SONATYPE_USERNAME") - password = System.getenv("SONATYPE_PASSWORD") - } - } - } } signing { @@ -133,6 +123,17 @@ signing { sign publishing.publications.release } +nexusPublishing { + repositories { + sonatype { + nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/") + snapshotRepositoryUrl = uri("https://central.sonatype.com/repository/maven-snapshots/") + username = System.getenv("SONATYPE_USERNAME") + password = System.getenv("SONATYPE_PASSWORD") + } + } +} + /** * {@link Package#getImplementationVersion()} on IDE will alway return `null` * because this method read data from `META-INF/MANIFEST.MF` that contain in `.jar`. diff --git a/src/test/java/co/omise/requests/TokenRequestTest.java b/src/test/java/co/omise/requests/TokenRequestTest.java index 94b2ed08..076da833 100644 --- a/src/test/java/co/omise/requests/TokenRequestTest.java +++ b/src/test/java/co/omise/requests/TokenRequestTest.java @@ -32,7 +32,7 @@ public void testCreate() throws IOException, OmiseException { .card(new Card.Create() .name("JOHN DOE") .number("4242424242424242") - .expiration(YearMonth.now().plusYears(1)) + .expiration(YearMonth.of(2026, 3)) .securityCode("123") .city("Bangkok") .postalCode("10240")