Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 24 additions & 22 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -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 }}
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 20 additions & 13 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<groupId>com.contentstack.sdk</groupId>
<artifactId>marketplace</artifactId>
<version>1.0.3</version>
<name>Contentstack Marketplace Java SDK</name>
<description>Contentstack Java Management SDK for Content Management API</description>
<url>https://github.com/contentstack/contentstack-management-java/</url>

Expand Down Expand Up @@ -33,7 +34,7 @@
<maven-site-plugin.version>4.0.0-M9</maven-site-plugin.version>
<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
<central-publishing-maven-plugin.version>0.8.0</central-publishing-maven-plugin.version>
<maven-release-plugin.version>3.0.1</maven-release-plugin.version>
</properties>

Expand Down Expand Up @@ -89,23 +90,21 @@
</developer>
</developers>

<!-- Old OSSRH/Nexus Configuration - Commented out for new Central Publishing -->
<!--
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<name>Apache Maven Packages Snapshot</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<!-- <snapshotRepository>
<id>github</id>
<name>GitHub Apache Maven Packages</name>
<url>https://maven.pkg.github.com/contentstack/contentstack-management-java</url>
</snapshotRepository> -->
<repository>
<id>ossrh</id>
<name>Apache Maven Packages Release</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
-->


<dependencies>
Expand Down Expand Up @@ -141,7 +140,7 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok-source.version}</version>
<scope>compile</scope>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.github.cdimascio</groupId>
Expand Down Expand Up @@ -273,6 +272,13 @@
<configuration>
<source>8</source>
<target>8</target>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok-source.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgument>-Xlint:all</compilerArgument>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
Expand All @@ -281,15 +287,16 @@
</compilerArgs>
</configuration>
</plugin>
<!-- New Central Publishing Maven Plugin -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-maven-plugin.version}</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${central-publishing-maven-plugin.version}</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
Loading