diff --git a/.github/workflows/release-sdks.yml b/.github/workflows/release-sdks.yml
index e0f688e..fbccbe1 100644
--- a/.github/workflows/release-sdks.yml
+++ b/.github/workflows/release-sdks.yml
@@ -79,23 +79,57 @@ jobs:
&& (github.event.inputs.SDKs == 'java' || github.event.inputs.SDKs == 'all'))
steps:
- - uses: actions/checkout@v2
-
- - name: Set up Java JDK
- uses: actions/setup-java@v1
+ - uses: actions/checkout@v3
+
+ - name: Import GPG key
+ run: |
+ echo "${{ secrets.MAVEN_GPG_PRIVATE_KEY }}" | gpg --batch --import
+ echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf
+
+ - name: Install xmllint
+ run: sudo apt-get update && sudo apt-get install -y libxml2-utils
+
+ - name: Extract version from pom.xml
+ id: get_version
+ run: |
+ version=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='version']/text()" ${{ env.JAVA_SDK_LOCATION }}/pom.xml)
+ echo "version=$version" >> $GITHUB_OUTPUT
+ if [[ "$version" == *SNAPSHOT* ]]; then
+ echo "is_snapshot=true" >> $GITHUB_OUTPUT
+ else
+ echo "is_snapshot=false" >> $GITHUB_OUTPUT
+ fi
+ - name: Set up JDK for snapshot repository
+ if: steps.get_version.outputs.is_snapshot == 'true'
+ uses: actions/setup-java@v4
with:
- java-version: 1.8
- server-id: ossrh
- server-username: MAVEN_USERNAME
- server-password: MAVEN_PASSWORD
- gpg-private-key: ${{ env.MAVEN_GPG_PRIVATE_KEY }}
+ java-version: '8'
+ distribution: 'temurin'
+ server-id: central-portal-snapshots
+ server-username: MAVEN_PORTAL_USERNAME
+ server-password: MAVEN_CENTRAL_TOKEN
+ gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
-
- - name: Build
- run: |
- mvn -B package --file ${{ env.JAVA_SDK_LOCATION }}/pom.xml
-
+
+ - name: Set up JDK for release repository
+ if: steps.get_version.outputs.is_snapshot == 'false'
+ uses: actions/setup-java@v4
+ with:
+ java-version: '8'
+ distribution: 'temurin'
+ server-id: central
+ server-username: MAVEN_PORTAL_USERNAME
+ server-password: MAVEN_CENTRAL_TOKEN
+ gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
+ gpg-passphrase: MAVEN_GPG_PASSPHRASE
+
+ - name: Build with Maven
+ run: mvn -B package --file ${{ env.JAVA_SDK_LOCATION }}/pom.xml
+
- name: Publish to Apache Maven Central
- run: |
- cd ${{ env.JAVA_SDK_LOCATION }}
- mvn -Psign-artifacts verify deploy
\ No newline at end of file
+ run: cd ${{ env.JAVA_SDK_LOCATION }} && mvn -Psign-artifacts verify deploy
+ env:
+ MAVEN_PORTAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
+ MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
+ MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
+
\ No newline at end of file
diff --git a/java/pom.xml b/java/pom.xml
index 8c9d7d3..05ce688 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -10,7 +10,7 @@
com.factset.protobuf
stachextensions
- 1.6.0
+ 1.6.1
@@ -21,10 +21,24 @@
+
+ Central Portal Snapshots
+ central-portal-snapshots
+ https://central.sonatype.com/repository/maven-snapshots/
+
+ true
+
+
+ true
+
+
- ossrh
- Central Repository OSSRH
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
+ central
+ Central Portal Releases
+ https://central.sonatype.com
+
+ true
+
@@ -100,7 +114,7 @@
org.apache.maven.plugins
maven-gpg-plugin
- 1.6
+ 3.2.8
sign-artifacts
@@ -118,6 +132,14 @@
+
+ org.sonatype.central
+ central-publishing-maven-plugin
+
+ central
+ validated
+
+
@@ -135,6 +157,15 @@
+
+ central-publishing-maven-plugin
+ org.sonatype.central
+ 0.8.0
+ true
+
+ ${project.groupId}-${project.artifactId}-${project.version}
+
+