diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index 0267439..bee0c7c 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -1,39 +1,41 @@ -# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created +# This workflow will build a package using Maven and then publish it to Maven Central using the new Central Publishing Plugin # For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path name: Maven Package on: + push: + branches: + - fix/DX-3277-release-workflow release: types: [created] jobs: - build: - + publish-maven: runs-on: ubuntu-latest permissions: contents: read packages: write steps: - - uses: actions/checkout@v3 - - name: Set up JDK 11 - uses: actions/setup-java@v3 - with: - java-version: '11' - distribution: 'temurin' - server-id: ossrh - server-username: MAVEN_USERNAME - server-password: MAVEN_PASSWORD - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - gpg-passphrase: GPG_PASSPHRASE + - uses: actions/checkout@v3 + - name: Set up Maven Central Repository + uses: actions/setup-java@v3 + with: + java-version: '11' + distribution: 'adopt' + server-id: central + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: GPG_PASSPHRASE - - name: Build with Maven - run: mvn -B package --file pom.xml + - name: Build with Maven + run: mvn -B package --file pom.xml - - name: Publish to GitHub Packages Apache Maven - run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy - env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} - MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + - name: Publish to the Maven Central Repository + run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index e5247f5..001e7b5 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -21,10 +21,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 17 + - name: Set up JDK 11 uses: actions/setup-java@v3 with: - java-version: '17' + java-version: '11' distribution: 'temurin' cache: maven - name: Build with Maven diff --git a/pom.xml b/pom.xml index 10cd4ba..f0cd851 100644 --- a/pom.xml +++ b/pom.xml @@ -6,6 +6,7 @@ com.contentstack.sdk marketplace 1.0.3 + Contentstack Marketplace Java SDK Contentstack Java Management SDK for Content Management API https://github.com/contentstack/contentstack-management-java/ @@ -33,7 +34,7 @@ 4.0.0-M9 3.1.0 3.11.0 - 1.6.13 + 0.8.0 3.0.1 @@ -89,23 +90,21 @@ + + ossrh Apache Maven Packages Release https://oss.sonatype.org/service/local/staging/deploy/maven2/ + --> @@ -141,7 +140,7 @@ org.projectlombok lombok ${lombok-source.version} - compile + provided io.github.cdimascio @@ -273,6 +272,13 @@ 8 8 + + + org.projectlombok + lombok + ${lombok-source.version} + + -Xlint:all true true @@ -281,15 +287,16 @@ + - org.sonatype.plugins - nexus-staging-maven-plugin - ${nexus-staging-maven-plugin.version} + org.sonatype.central + central-publishing-maven-plugin + ${central-publishing-maven-plugin.version} true - ossrh - https://oss.sonatype.org/ - true + central + true + published diff --git a/src/main/java/com/contentstack/sdk/marketplace/Marketplace.java b/src/main/java/com/contentstack/sdk/marketplace/Marketplace.java index b1886ff..ebad1fd 100644 --- a/src/main/java/com/contentstack/sdk/marketplace/Marketplace.java +++ b/src/main/java/com/contentstack/sdk/marketplace/Marketplace.java @@ -46,6 +46,9 @@ public static class Builder { public Builder(@NotNull String organizationUid) { + if (organizationUid == null) { + throw new IllegalArgumentException(Constants.ERROR_NO_ORGANIZATION_UID); + } if (organizationUid.isEmpty()) { throw new NullPointerException("Empty fields are not allowed"); }