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
68 changes: 51 additions & 17 deletions .github/workflows/release-sdks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 }}

41 changes: 36 additions & 5 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<groupId>com.factset.protobuf</groupId>
<artifactId>stachextensions</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>

<licenses>
<license>
Expand All @@ -21,10 +21,24 @@
</licenses>

<distributionManagement>
<snapshotRepository>
<name>Central Portal Snapshots</name>
<id>central-portal-snapshots</id>
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</snapshotRepository>
<repository>
<id>ossrh</id>
<name>Central Repository OSSRH</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<id>central</id>
<name>Central Portal Releases</name>
<url>https://central.sonatype.com</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</distributionManagement>

Expand Down Expand Up @@ -100,7 +114,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<version>3.2.8</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -118,6 +132,14 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<configuration>
<publishingServerId>central</publishingServerId>
<waitUntil>validated</waitUntil>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Expand All @@ -135,6 +157,15 @@
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>central-publishing-maven-plugin</artifactId>
<groupId>org.sonatype.central</groupId>
<version>0.8.0</version>
<extensions>true</extensions>
<configuration>
<deploymentName>${project.groupId}-${project.artifactId}-${project.version}</deploymentName>
</configuration>
</plugin>
</plugins>
</build>

Expand Down