Skip to content

Commit 0e6af2a

Browse files
Move from OSSRH to maven central publishing (#924)
## Description Moved the jar publishing action from the legacy OSSRH/Sonatype deployment approach to the new Maven Central Publishing and updated GitHub Actions workflow. More context - https://central.sonatype.org/news/20250326_ossrh_sunset/ ## Plugin and Dependency Updates Upgraded `maven-source-plugin` to version 3.3.1 (from 3.3.0). Upgraded `maven-javadoc-plugin` to version 3.8.0 (from 3.6.0). ## Testing Released the v1.0.8-oss using this action ## Additional Notes to the Reviewer NA `NO_CHANGELOG=true` --------- Co-authored-by: Samikshya Chand <148681192+samikshya-db@users.noreply.github.com>
1 parent 582896e commit 0e6af2a

3 files changed

Lines changed: 40 additions & 69 deletions

File tree

.github/workflows/release.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,27 @@ jobs:
1616

1717
- name: Set up Java for publishing to Maven Central Repository
1818
uses: actions/setup-java@v4
19-
env:
20-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
21-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
22-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
2319
with:
2420
java-version: 11
25-
server-id: ossrh
21+
server-id: central
2622
distribution: "adopt"
27-
server-username: OSSRH_USERNAME
28-
server-password: OSSRH_PASSWORD
23+
server-username: MAVEN_CENTRAL_USERNAME
24+
server-password: MAVEN_CENTRAL_PASSWORD
2925
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
3026
gpg-passphrase: GPG_PASSPHRASE
3127

28+
- name: Configure GPG
29+
run: |
30+
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
31+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
32+
gpg-connect-agent reloadagent /bye
33+
3234
- name: Publish to the Maven Central Repository
3335
run: mvn -Prelease --batch-mode deploy -Dnvd.api.key=${{ secrets.NVD_API_KEY }}
3436
env:
3537
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
36-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
37-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
38+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
39+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
3840

3941
- name: Create GitHub release
4042
uses: softprops/action-gh-release@v1

pom.xml

Lines changed: 29 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@
616616
<plugin>
617617
<groupId>org.apache.maven.plugins</groupId>
618618
<artifactId>maven-source-plugin</artifactId>
619-
<version>3.3.0</version>
619+
<version>3.3.1</version>
620620
<executions>
621621
<execution>
622622
<id>attach-sources</id>
@@ -629,7 +629,7 @@
629629
<plugin>
630630
<groupId>org.apache.maven.plugins</groupId>
631631
<artifactId>maven-javadoc-plugin</artifactId>
632-
<version>3.6.0</version>
632+
<version>3.8.0</version>
633633
<configuration>
634634
<doclint>none</doclint>
635635
<sourcepath>${project.build.sourceDirectory}:${project.build.directory}/generated-sources/annotations</sourcepath>
@@ -647,71 +647,46 @@
647647
<groupId>org.apache.maven.plugins</groupId>
648648
<artifactId>maven-gpg-plugin</artifactId>
649649
<version>1.6</version>
650+
<configuration>
651+
<gpgArguments>
652+
<arg>--batch</arg>
653+
<arg>--pinentry-mode</arg>
654+
<arg>loopback</arg>
655+
<arg>--no-tty</arg>
656+
<arg>--yes</arg>
657+
</gpgArguments>
658+
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
659+
<!-- Custom reduced pom file for fat jar -->
660+
<pomFile>${project.basedir}/uber-minimal-pom.xml</pomFile>
661+
<sources>${project.build.directory}/${project.build.finalName}-sources.jar</sources>
662+
<javadoc>${project.build.directory}/${project.build.finalName}-javadoc.jar</javadoc>
663+
<files>${project.build.directory}/${project.build.finalName}-thin.jar</files>
664+
<types>jar</types>
665+
<classifiers>thin</classifiers>
666+
</configuration>
650667
<executions>
651668
<execution>
669+
<id>sign-artifacts</id>
652670
<goals>
653-
<!-- Refer: https://maven.apache.org/plugins/maven-gpg-plugin/sign-and-deploy-file-mojo.html -->
654-
<goal>sign-and-deploy-file</goal>
671+
<goal>sign</goal>
655672
</goals>
656-
<phase>deploy</phase>
657-
<configuration>
658-
<file>${project.build.directory}/${project.build.finalName}.jar</file>
659-
<repositoryId>ossrh</repositoryId>
660-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
661-
<!-- Prevent gpg from using pinentry programs -->
662-
<gpgArguments>
663-
<arg>--pinentry-mode</arg>
664-
<arg>loopback</arg>
665-
</gpgArguments>
666-
<!-- Custom reduced pom file for fat jar -->
667-
<pomFile>${project.basedir}/uber-minimal-pom.xml</pomFile>
668-
<sources>${project.build.directory}/${project.build.finalName}-sources.jar</sources>
669-
<javadoc>${project.build.directory}/${project.build.finalName}-javadoc.jar</javadoc>
670-
<files>${project.build.directory}/${project.build.finalName}-thin.jar</files>
671-
<types>jar</types>
672-
<classifiers>thin</classifiers>
673-
</configuration>
673+
<phase>verify</phase>
674674
</execution>
675675
</executions>
676676
</plugin>
677677
<plugin>
678-
<groupId>org.apache.maven.plugins</groupId>
679-
<artifactId>maven-deploy-plugin</artifactId>
680-
<version>2.8.2</version>
678+
<groupId>org.sonatype.central</groupId>
679+
<artifactId>central-publishing-maven-plugin</artifactId>
680+
<version>0.8.0</version>
681+
<extensions>true</extensions>
681682
<configuration>
682-
<skip>true</skip>
683+
<publishingServerId>central</publishingServerId>
684+
<autoPublish>true</autoPublish>
685+
<waitUntil>published</waitUntil>
683686
</configuration>
684687
</plugin>
685-
<!-- <plugin>-->
686-
<!-- <groupId>org.sonatype.plugins</groupId>-->
687-
<!-- <artifactId>nexus-staging-maven-plugin</artifactId>-->
688-
<!-- <version>1.6.13</version>-->
689-
<!-- <extensions>true</extensions>-->
690-
<!-- <configuration>-->
691-
<!-- <serverId>ossrh</serverId>-->
692-
<!-- <nexusUrl>https://oss.sonatype.org/</nexusUrl>-->
693-
<!-- <autoReleaseAfterClose>true</autoReleaseAfterClose>-->
694-
<!-- <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>-->
695-
<!-- </configuration>-->
696-
<!-- <executions>-->
697-
<!-- <execution>-->
698-
<!-- <id>nexus-deploy</id>-->
699-
<!-- <phase>deploy</phase>-->
700-
<!-- <goals>-->
701-
<!-- <goal>close</goal>-->
702-
<!-- <goal>release</goal>-->
703-
<!-- </goals>-->
704-
<!-- </execution>-->
705-
<!-- </executions>-->
706-
<!-- </plugin>-->
707688
</plugins>
708689
</build>
709-
<distributionManagement>
710-
<repository>
711-
<id>ossrh</id>
712-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
713-
</repository>
714-
</distributionManagement>
715690
</profile>
716691
</profiles>
717692
</project>

uber-minimal-pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,4 @@
3333
<system>GitHub Issues</system>
3434
<url>https://github.com/databricks/databricks-jdbc/issues</url>
3535
</issueManagement>
36-
<distributionManagement>
37-
<repository>
38-
<id>ossrh</id>
39-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
40-
</repository>
41-
</distributionManagement>
4236
</project>

0 commit comments

Comments
 (0)