Skip to content

Commit 9a5e7c9

Browse files
authored
Unified release workflow for shaded and thin JARs (#1073)
## Summary This PR implements a unified release workflow that publishes both the shaded uber JAR and thin JAR to Maven Central in a single GitHub Actions workflow. ## Changes 1. **Added `build-helper-maven-plugin`** to `pom.xml`: - Attaches the unshaded JAR with `-thin` classifier before the shade plugin runs - Preserves the original JAR as `databricks-jdbc-${VERSION}-thin.jar` 2. **Updated `.github/workflows/release.yml`**: - Added GPG configuration for signing - Kept existing step to deploy shaded JAR (main artifact) - Added new step to deploy thin JAR as separate artifact with custom POM 3. **Removed `.github/workflows/release-thin.yml`**: - No longer needed - both JARs now published in single unified workflow ## Published Artifacts - **Shaded JAR**: `com.databricks:databricks-jdbc:3.0.1` (37MB, includes all dependencies) - **Thin JAR**: `com.databricks:databricks-jdbc-thin:3.0.1` (2.4MB, driver classes only) ## Testing ```bash mvn clean && mvn -B -DskipTests package # Verified both JARs created successfully: # - target/databricks-jdbc-3.0.1.jar (37MB shaded) # - target/databricks-jdbc-3.0.1-thin.jar (2.4MB thin) ``` ## Backward Compatibility ✅ Existing users are unaffected - the main artifact remains the shaded uber JAR --- NO_CHANGELOG=true --------- Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
1 parent 5d10d37 commit 9a5e7c9

3 files changed

Lines changed: 51 additions & 69 deletions

File tree

.github/workflows/release-thin.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ jobs:
2727
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
2828
gpg-passphrase: GPG_PASSPHRASE
2929

30-
- name: Publish to the Maven Central Repository
30+
- name: Configure GPG
3131
run: |
32-
# Deploy main artifacts (uber JAR, sources, javadoc)
32+
echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
33+
echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
34+
gpg-connect-agent reloadagent /bye
35+
36+
- name: Publish shaded JAR to Maven Central
37+
run: |
38+
# Deploy main artifacts (shaded uber JAR, sources, javadoc)
3339
mvn -Prelease --batch-mode deploy \
3440
-Dnvd.api.key=${{ secrets.NVD_API_KEY }} \
3541
-Dossindex.username=${{ secrets.OSSINDEX_USERNAME }} \
@@ -39,8 +45,26 @@ jobs:
3945
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
4046
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
4147

48+
- name: Publish thin JAR as separate artifact to Maven Central
49+
run: |
50+
VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
51+
mvn -Prelease gpg:sign-and-deploy-file \
52+
-Dfile="target/databricks-jdbc-${VERSION}-thin.jar" \
53+
-DpomFile=thin_public_pom.xml \
54+
-DrepositoryId=central \
55+
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
56+
-DgroupId=com.databricks \
57+
-DartifactId=databricks-jdbc-thin \
58+
-Dversion="${VERSION}" \
59+
-Dpackaging=jar \
60+
-Dgpg.passphrase="${GPG_PASSPHRASE}"
61+
env:
62+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
63+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
64+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
65+
4266
- name: Create GitHub release
4367
uses: softprops/action-gh-release@v1
4468
with:
4569
files: |
46-
files: target/*.jar
70+
target/*.jar

pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,30 @@
474474
</excludes>
475475
</configuration>
476476
</plugin>
477+
<!-- Attach unshaded JAR before shade plugin runs -->
478+
<plugin>
479+
<groupId>org.codehaus.mojo</groupId>
480+
<artifactId>build-helper-maven-plugin</artifactId>
481+
<version>3.6.1</version>
482+
<executions>
483+
<execution>
484+
<id>attach-thin-jar</id>
485+
<phase>package</phase>
486+
<goals>
487+
<goal>attach-artifact</goal>
488+
</goals>
489+
<configuration>
490+
<artifacts>
491+
<artifact>
492+
<file>${project.build.directory}/${project.build.finalName}.jar</file>
493+
<type>jar</type>
494+
<classifier>thin</classifier>
495+
</artifact>
496+
</artifacts>
497+
</configuration>
498+
</execution>
499+
</executions>
500+
</plugin>
477501
<plugin>
478502
<groupId>org.apache.maven.plugins</groupId>
479503
<artifactId>maven-shade-plugin</artifactId>

0 commit comments

Comments
 (0)