@@ -31,111 +31,37 @@ jobs:
3131
3232 - name : Set up Java for publishing to Maven Central Repository
3333 uses : actions/setup-java@v4
34+ env :
35+ GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
3436 with :
3537 java-version : 11
36- distribution : " adopt"
3738 server-id : central
39+ distribution : " adopt"
3840 server-username : MAVEN_CENTRAL_USERNAME
3941 server-password : MAVEN_CENTRAL_PASSWORD
4042 gpg-private-key : ${{ secrets.GPG_PRIVATE_KEY }}
4143 gpg-passphrase : GPG_PASSPHRASE
4244
43- - name : Configure GPG
45+ # Step 1: Build and install dependencies to local Maven repository
46+ # This builds jdbc-core (and parent) without publishing them.
47+ # The -am flag builds all dependencies needed by assembly-thin.
48+ # We use -Prelease here to generate sources/javadoc JARs for jdbc-core,
49+ # which assembly-thin needs for its own sources/javadoc artifacts.
50+ # GPG signing is skipped since we're only installing locally, not publishing.
51+ - name : Build dependencies
4452 run : |
45- echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf
46- echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf
47- gpg-connect-agent reloadagent /bye
53+ mvn -Prelease clean install --batch-mode -pl jdbc-core -am -Dgpg.skip=true
4854
49- - name : Build thin JAR with sources and javadocs
55+ # Step 2: Deploy only the thin JAR module to Maven Central
56+ # We don't use -am here to avoid the central-publishing-maven-plugin
57+ # from collecting parent/jdbc-core artifacts into the deployment bundle.
58+ # The jdbc-core dependency is already available from Step 1.
59+ - name : Publish thin JAR to Maven Central
5060 run : |
51- # Build main artifacts including sources and javadocs
52- mvn -B -DskipTests package source:jar javadoc:jar
53-
54- - name : Sign all thin JAR artifacts
55- run : |
56- VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
57-
58- # Sign thin JAR
59- echo "$GPG_PASSPHRASE" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback \
60- --armor --detach-sign "target/databricks-jdbc-${VERSION}-thin.jar"
61-
62- # Sign sources JAR
63- echo "$GPG_PASSPHRASE" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback \
64- --armor --detach-sign "target/databricks-jdbc-${VERSION}-sources.jar"
65-
66- # Sign javadoc JAR
67- echo "$GPG_PASSPHRASE" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback \
68- --armor --detach-sign "target/databricks-jdbc-${VERSION}-javadoc.jar"
69- env :
70- GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
71-
72- - name : Verify all required artifacts exist
73- run : |
74- VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
75- test -f "target/databricks-jdbc-${VERSION}-thin.jar"
76- test -f "target/databricks-jdbc-${VERSION}-thin.jar.asc"
77- test -f "target/databricks-jdbc-${VERSION}-sources.jar"
78- test -f "target/databricks-jdbc-${VERSION}-sources.jar.asc"
79- test -f "target/databricks-jdbc-${VERSION}-javadoc.jar"
80- test -f "target/databricks-jdbc-${VERSION}-javadoc.jar.asc"
81-
82- - name : Publish Thin JAR as Separate Artifact to Maven Central
83- run : |
84- VERSION=$(grep -m1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/')
85-
86- echo "Creating deployment bundle for thin JAR..."
87-
88- # Create staging directory
89- mkdir -p target/thin-staging/com/databricks/databricks-jdbc-thin/${VERSION}
90-
91- # Copy thin JAR and its signature
92- cp "target/databricks-jdbc-${VERSION}-thin.jar" \
93- target/thin-staging/com/databricks/databricks-jdbc-thin/${VERSION}/databricks-jdbc-thin-${VERSION}.jar
94- cp "target/databricks-jdbc-${VERSION}-thin.jar.asc" \
95- target/thin-staging/com/databricks/databricks-jdbc-thin/${VERSION}/databricks-jdbc-thin-${VERSION}.jar.asc
96-
97- # Copy sources JAR and its signature
98- cp "target/databricks-jdbc-${VERSION}-sources.jar" \
99- target/thin-staging/com/databricks/databricks-jdbc-thin/${VERSION}/databricks-jdbc-thin-${VERSION}-sources.jar
100- cp "target/databricks-jdbc-${VERSION}-sources.jar.asc" \
101- target/thin-staging/com/databricks/databricks-jdbc-thin/${VERSION}/databricks-jdbc-thin-${VERSION}-sources.jar.asc
102-
103- # Copy javadoc JAR and its signature
104- cp "target/databricks-jdbc-${VERSION}-javadoc.jar" \
105- target/thin-staging/com/databricks/databricks-jdbc-thin/${VERSION}/databricks-jdbc-thin-${VERSION}-javadoc.jar
106- cp "target/databricks-jdbc-${VERSION}-javadoc.jar.asc" \
107- target/thin-staging/com/databricks/databricks-jdbc-thin/${VERSION}/databricks-jdbc-thin-${VERSION}-javadoc.jar.asc
108-
109- # Copy POM and sign it
110- cp thin_public_pom.xml target/thin-staging/com/databricks/databricks-jdbc-thin/${VERSION}/databricks-jdbc-thin-${VERSION}.pom
111- echo "$GPG_PASSPHRASE" | gpg --batch --yes --passphrase-fd 0 --pinentry-mode loopback \
112- --armor --detach-sign \
113- target/thin-staging/com/databricks/databricks-jdbc-thin/${VERSION}/databricks-jdbc-thin-${VERSION}.pom
114-
115- # Generate checksums for all files
116- cd target/thin-staging/com/databricks/databricks-jdbc-thin/${VERSION}
117- for file in databricks-jdbc-thin-*; do
118- md5sum "$file" | awk '{print $1}' > "${file}.md5"
119- sha1sum "$file" | awk '{print $1}' > "${file}.sha1"
120- done
121- cd $GITHUB_WORKSPACE
122-
123- # Create bundle ZIP
124- cd target/thin-staging
125- zip -r ../central-thin-bundle.zip com/
126- cd $GITHUB_WORKSPACE
127-
128- echo "Uploading bundle to Maven Central Portal..."
129-
130- # Upload to new Maven Central Portal
131- curl -X POST \
132- -u "$MAVEN_CENTRAL_USERNAME:$MAVEN_CENTRAL_PASSWORD" \
133- -F "bundle=@target/central-thin-bundle.zip" \
134- -F "publishingType=AUTOMATIC" \
135- -w "\nHTTP_STATUS:%{http_code}\n" \
136- https://central.sonatype.com/api/v1/publisher/upload
137-
138- echo "Thin JAR published successfully!"
61+ mvn -Prelease deploy --batch-mode -pl assembly-thin \
62+ -Dnvd.api.key=${{ secrets.NVD_API_KEY }} \
63+ -Dossindex.username=${{ secrets.OSSINDEX_USERNAME }} \
64+ -Dossindex.password=${{ secrets.OSSINDEX_PASSWORD }}
13965 env :
14066 GPG_PASSPHRASE : ${{ secrets.GPG_PASSPHRASE }}
14167 MAVEN_CENTRAL_USERNAME : ${{ secrets.MAVEN_CENTRAL_USERNAME }}
@@ -174,5 +100,4 @@ jobs:
174100 with :
175101 tag_name : ${{ steps.get_tag.outputs.tag }}
176102 files : |
177- target/*-thin.jar
178-
103+ assembly-thin/target/databricks-jdbc-thin-*.jar
0 commit comments