Skip to content
20 changes: 11 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,27 @@ jobs:

- name: Set up Java for publishing to Maven Central Repository
uses: actions/setup-java@v4
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
with:
java-version: 11
server-id: ossrh
server-id: central
distribution: "adopt"
server-username: OSSRH_USERNAME
server-password: OSSRH_PASSWORD
server-username: MAVEN_CENTRAL_USERNAME
server-password: MAVEN_CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: GPG_PASSPHRASE

- name: Configure GPG
run: |
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
gpg-connect-agent reloadagent /bye

- name: Publish to the Maven Central Repository
run: mvn -Prelease --batch-mode deploy -Dnvd.api.key=${{ secrets.NVD_API_KEY }}
env:
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}

- name: Create GitHub release
uses: softprops/action-gh-release@v1
Expand Down
83 changes: 29 additions & 54 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.3.1</version>
<executions>
<execution>
<id>attach-sources</id>
Expand All @@ -629,7 +629,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.0</version>
<version>3.8.0</version>
<configuration>
<doclint>none</doclint>
<sourcepath>${project.build.sourceDirectory}:${project.build.directory}/generated-sources/annotations</sourcepath>
Expand All @@ -647,71 +647,46 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
Comment thread
jprakash-db marked this conversation as resolved.
<configuration>
<gpgArguments>
<arg>--batch</arg>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
<arg>--no-tty</arg>
<arg>--yes</arg>
</gpgArguments>
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
<!-- Custom reduced pom file for fat jar -->
<pomFile>${project.basedir}/uber-minimal-pom.xml</pomFile>
<sources>${project.build.directory}/${project.build.finalName}-sources.jar</sources>
<javadoc>${project.build.directory}/${project.build.finalName}-javadoc.jar</javadoc>
<files>${project.build.directory}/${project.build.finalName}-thin.jar</files>
<types>jar</types>
<classifiers>thin</classifiers>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<goals>
<!-- Refer: https://maven.apache.org/plugins/maven-gpg-plugin/sign-and-deploy-file-mojo.html -->
<goal>sign-and-deploy-file</goal>
<goal>sign</goal>
</goals>
<phase>deploy</phase>
<configuration>
<file>${project.build.directory}/${project.build.finalName}.jar</file>
<repositoryId>ossrh</repositoryId>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
<!-- Prevent gpg from using pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
<!-- Custom reduced pom file for fat jar -->
<pomFile>${project.basedir}/uber-minimal-pom.xml</pomFile>
<sources>${project.build.directory}/${project.build.finalName}-sources.jar</sources>
<javadoc>${project.build.directory}/${project.build.finalName}-javadoc.jar</javadoc>
<files>${project.build.directory}/${project.build.finalName}-thin.jar</files>
<types>jar</types>
<classifiers>thin</classifiers>
</configuration>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.8.0</version>
<extensions>true</extensions>
<configuration>
<skip>true</skip>
<publishingServerId>central</publishingServerId>
Comment thread
jprakash-db marked this conversation as resolved.
<autoPublish>true</autoPublish>
<waitUntil>published</waitUntil>
</configuration>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.sonatype.plugins</groupId>-->
<!-- <artifactId>nexus-staging-maven-plugin</artifactId>-->
<!-- <version>1.6.13</version>-->
<!-- <extensions>true</extensions>-->
<!-- <configuration>-->
<!-- <serverId>ossrh</serverId>-->
<!-- <nexusUrl>https://oss.sonatype.org/</nexusUrl>-->
<!-- <autoReleaseAfterClose>true</autoReleaseAfterClose>-->
<!-- <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>-->
<!-- </configuration>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>nexus-deploy</id>-->
<!-- <phase>deploy</phase>-->
<!-- <goals>-->
<!-- <goal>close</goal>-->
<!-- <goal>release</goal>-->
<!-- </goals>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
</plugins>
</build>
<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</profile>
</profiles>
</project>
6 changes: 0 additions & 6 deletions uber-minimal-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,4 @@
<system>GitHub Issues</system>
<url>https://github.com/databricks/databricks-jdbc/issues</url>
</issueManagement>
<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</project>
Loading