Release Thin JAR #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release Thin JAR | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| publish-thin: | |
| runs-on: | |
| group: databricks-protected-runner-group | |
| labels: linux-ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Java for publishing to Maven Central Repository | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: 11 | |
| distribution: "adopt" | |
| server-id: central | |
| 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: Build thin JAR | |
| run: | | |
| mvn -B -DskipTests package | |
| - name: Verify thin jar exists | |
| run: | | |
| VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/') | |
| test -f "target/databricks-jdbc-${VERSION}-thin.jar" | |
| - name: Publish Thin JAR as Separate Artifact to Maven Central | |
| run: | | |
| VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/') | |
| mvn -Prelease gpg:sign-and-deploy-file \ | |
| -Dfile="target/databricks-jdbc-${VERSION}-thin.jar" \ | |
| -DrepositoryId=central \ | |
| -Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \ | |
| -DgroupId=com.databricks \ | |
| -DartifactId=databricks-jdbc-thin \ | |
| -Dversion="${VERSION}" \ | |
| -Dpackaging=jar \ | |
| -DgeneratePom=true \ | |
| -Dgpg.passphrase="${GPG_PASSPHRASE}" | |
| env: | |
| GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
| MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} | |
| MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} | |
| - name: Upload Thin JAR to GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| target/*-thin.jar | |