Skip to content

Commit 72a7392

Browse files
authored
Fix Release Workflow to publish in Maven Central. (#489)
## What changes are proposed in this pull request? This fixes three things in the release workflow: - It fixes how we pass the secrets to setup-java. Previously, the secret was passed in the format of {env.Secret}. - Added a block in the pom file that signs the binary. - Added the name of the JAVA Library in the pom file. ## How is this tested? Manually tested. NO_CHANGELOG=true
1 parent 9247359 commit 72a7392

File tree

3 files changed

+34
-4
lines changed

3 files changed

+34
-4
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,28 @@ jobs:
2828
java-version: 8
2929
server-id: central
3030
distribution: "adopt"
31-
server-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
32-
server-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
31+
server-username: MAVEN_CENTRAL_USERNAME
32+
server-password: MAVEN_CENTRAL_PASSWORD
3333
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
34-
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
35-
34+
gpg-passphrase: GPG_PASSPHRASE
35+
3636
# This step runs ONLY on branch pushes (dry-run)
3737
- name: Run Release Dry-Run (Verify)
3838
if: "!startsWith(github.ref, 'refs/tags/')"
3939
run: mvn -Prelease -DskipTests=true --batch-mode verify
40+
env:
41+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
42+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
43+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
4044

4145
# This step runs ONLY on tag pushes (real release)
4246
- name: Publish to Maven Central Repository (Deploy)
4347
if: "startsWith(github.ref, 'refs/tags/')"
4448
run: mvn -Prelease -DskipTests=true --batch-mode deploy
49+
env:
50+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
51+
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
52+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
4553

4654
# This step also runs ONLY on tag pushes (real release)
4755
- name: Create GitHub release

databricks-sdk-java/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<version>0.55.0</version>
99
</parent>
1010
<artifactId>databricks-sdk-java</artifactId>
11+
<name>Databricks SDK for Java</name>
1112
<properties>
1213
<httpclient.version>4.5.14</httpclient.version>
1314
<jackson.version>2.15.2</jackson.version>

pom.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,27 @@
256256
</execution>
257257
</executions>
258258
</plugin>
259+
<plugin>
260+
<groupId>org.apache.maven.plugins</groupId>
261+
<artifactId>maven-gpg-plugin</artifactId>
262+
<version>1.6</version>
263+
<configuration>
264+
<!-- Prevent gpg from using pinentry programs -->
265+
<gpgArguments>
266+
<arg>--pinentry-mode</arg>
267+
<arg>loopback</arg>
268+
</gpgArguments>
269+
</configuration>
270+
<executions>
271+
<execution>
272+
<id>sign-artifacts</id>
273+
<goals>
274+
<goal>sign</goal>
275+
</goals>
276+
<phase>verify</phase>
277+
</execution>
278+
</executions>
279+
</plugin>
259280
<plugin>
260281
<groupId>org.sonatype.central</groupId>
261282
<artifactId>central-publishing-maven-plugin</artifactId>

0 commit comments

Comments
 (0)