Skip to content

Commit acbfdf2

Browse files
authored
Fix thin jar creation and pushing to maven (#1015)
## Description - Fix failing workflow https://github.com/databricks/databricks-jdbc/actions/runs/17834506603/job/50712970652 - Keep the thin jar publish as a separate workflow.
1 parent 2f99ac0 commit acbfdf2

4 files changed

Lines changed: 74 additions & 22 deletions

File tree

.github/workflows/release-thin.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Release Thin JAR
2+
on:
3+
push:
4+
tags:
5+
- 'v*'
6+
workflow_dispatch:
7+
8+
jobs:
9+
publish-thin:
10+
runs-on:
11+
group: databricks-protected-runner-group
12+
labels: linux-ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Java for publishing to Maven Central Repository
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: 11
21+
distribution: "adopt"
22+
server-id: central
23+
server-username: MAVEN_CENTRAL_USERNAME
24+
server-password: MAVEN_CENTRAL_PASSWORD
25+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
26+
gpg-passphrase: GPG_PASSPHRASE
27+
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+
34+
- name: Build thin JAR
35+
run: |
36+
mvn -B -DskipTests package
37+
38+
- name: Verify thin jar exists
39+
run: |
40+
VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
41+
test -f "target/databricks-jdbc-${VERSION}-oss-thin.jar"
42+
43+
- name: Publish Thin JAR as Separate Artifact to Maven Central
44+
run: |
45+
VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
46+
mvn -Prelease gpg:sign-and-deploy-file \
47+
-Dfile="target/databricks-jdbc-${VERSION}-oss-thin.jar" \
48+
-DrepositoryId=central \
49+
-Durl=https://oss.sonatype.org/service/local/staging/deploy/maven2/ \
50+
-DgroupId=com.databricks \
51+
-DartifactId=databricks-jdbc-thin \
52+
-Dversion="${VERSION}" \
53+
-Dpackaging=jar \
54+
-DgeneratePom=true \
55+
-Dgpg.passphrase="${GPG_PASSPHRASE}"
56+
env:
57+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
58+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
59+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
60+
61+
- name: Upload Thin JAR to GitHub Release
62+
uses: softprops/action-gh-release@v1
63+
with:
64+
files: |
65+
target/*-oss-thin.jar
66+

.github/workflows/release.yml

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -39,28 +39,12 @@ jobs:
3939
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
4040
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
4141
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
42-
43-
- name: Publish Thin JAR as Separate Artifact
44-
run: |
45-
# Sign and deploy thin JAR with full dependency metadata
46-
# Uses GPG signing to ensure artifact integrity
47-
VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
48-
mvn -Prelease gpg:sign-and-deploy-file \
49-
-Dfile="target/databricks-jdbc-${VERSION}-thin.jar" \
50-
-DpomFile=thin_public_pom.xml \
51-
-DrepositoryId=central \
52-
-DgroupId=com.databricks \
53-
-DartifactId=databricks-jdbc-thin \
54-
-Dversion="${VERSION}" \
55-
-Dpackaging=jar \
56-
-DgeneratePom=false \
57-
-Dgpg.passphrase="${GPG_PASSPHRASE}"
58-
env:
59-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
60-
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
61-
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
6242

6343
- name: Create GitHub release
6444
uses: softprops/action-gh-release@v1
6545
with:
66-
files: target/*.jar
46+
files: |
47+
target/databricks-jdbc-*-oss.jar
48+
target/databricks-jdbc-*-sources.jar
49+
target/databricks-jdbc-*-javadoc.jar
50+
fail_on_unmatched_files: false

development/.release-freeze.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"freeze": true,
33
"reason": "Releasing JDBC - 16th Sep",
4-
"allow_list": ["samikshya-chand_data/upgradesdk","bump-v1.1.0","shivam2680/release-fix"]
4+
"allow_list": ["samikshya-chand_data/n"]
55
}

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,5 +703,7 @@
703703
</plugins>
704704
</build>
705705
</profile>
706+
706707
</profiles>
708+
707709
</project>

0 commit comments

Comments
 (0)