Skip to content

Commit 69d8dcf

Browse files
Publish to the Central Repository. (#481)
## What changes are proposed in this pull request? This PR updates the release workflow to publish to the Sonatype Central Repository instead of OSSRH — which is [deprecated](https://central.sonatype.org/news/20250326_ossrh_sunset/). The PR also update the workflow to run a dry-run on pushes — which is used to validate this PR. ## How is this tested? See above, the workflow now does dry runs on pushes. NO_CHANGELOG=true
1 parent 3a1bbb1 commit 69d8dcf

File tree

2 files changed

+29
-43
lines changed

2 files changed

+29
-43
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
name: Release
2+
23
on:
34
push:
5+
# Run a real release on pushes to tags like v1.0, v2.3.4, etc.
46
tags:
57
- "v*"
8+
# Run a dry-run on pushes to any branch
9+
branches:
10+
- "**"
11+
612
jobs:
713
publish:
14+
# Dynamically set the job name based on the trigger
15+
name: ${{ startsWith(github.ref, 'refs/tags/') && 'Publish Release' || 'Run Release Dry-Run' }}
16+
817
runs-on:
918
group: databricks-deco-testing-runner-group
1019
labels: ubuntu-latest-deco
@@ -17,21 +26,26 @@ jobs:
1726
uses: actions/setup-java@v3
1827
with:
1928
java-version: 8
20-
server-id: ossrh
29+
server-id: central
2130
distribution: "adopt"
22-
server-username: OSSRH_USERNAME
23-
server-password: OSSRH_PASSWORD
31+
server-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
32+
server-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
2433
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
25-
gpg-passphrase: GPG_PASSPHRASE
34+
gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
35+
36+
# This step runs ONLY on branch pushes (dry-run)
37+
- name: Run Release Dry-Run (Verify)
38+
if: "!startsWith(github.ref, 'refs/tags/')"
39+
run: mvn -Prelease -DskipTests=true --batch-mode verify
2640

27-
- name: Publish to the Maven Central Repository
41+
# This step runs ONLY on tag pushes (real release)
42+
- name: Publish to Maven Central Repository (Deploy)
43+
if: "startsWith(github.ref, 'refs/tags/')"
2844
run: mvn -Prelease -DskipTests=true --batch-mode deploy
29-
env:
30-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
31-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
32-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
3345

46+
# This step also runs ONLY on tag pushes (real release)
3447
- name: Create GitHub release
48+
if: "startsWith(github.ref, 'refs/tags/')"
3549
uses: softprops/action-gh-release@v1
3650
with:
37-
files: target/*.jar
51+
files: target/*.jar

pom.xml

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,6 @@
4848
<system>GitHub Actions</system>
4949
<url>https://github.com/databricks/databricks-sdk-java/blob/main/.github/workflows/push.yml</url>
5050
</ciManagement>
51-
<distributionManagement>
52-
<repository>
53-
<id>ossrh</id>
54-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
55-
</repository>
56-
</distributionManagement>
5751
<properties>
5852
<jacoco.version>0.8.10</jacoco.version>
5953
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -263,35 +257,13 @@
263257
</executions>
264258
</plugin>
265259
<plugin>
266-
<groupId>org.apache.maven.plugins</groupId>
267-
<artifactId>maven-gpg-plugin</artifactId>
268-
<version>1.6</version>
269-
<configuration>
270-
<!-- Prevent gpg from using pinentry programs -->
271-
<gpgArguments>
272-
<arg>--pinentry-mode</arg>
273-
<arg>loopback</arg>
274-
</gpgArguments>
275-
</configuration>
276-
<executions>
277-
<execution>
278-
<id>sign-artifacts</id>
279-
<goals>
280-
<goal>sign</goal>
281-
</goals>
282-
<phase>verify</phase>
283-
</execution>
284-
</executions>
285-
</plugin>
286-
<plugin>
287-
<groupId>org.sonatype.plugins</groupId>
288-
<artifactId>nexus-staging-maven-plugin</artifactId>
289-
<version>1.6.13</version>
260+
<groupId>org.sonatype.central</groupId>
261+
<artifactId>central-publishing-maven-plugin</artifactId>
262+
<version>0.5.0</version>
290263
<extensions>true</extensions>
291264
<configuration>
292-
<serverId>ossrh</serverId>
293-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
294-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
265+
<publishingServerId>central</publishingServerId>
266+
<autoPublish>true</autoPublish>
295267
</configuration>
296268
</plugin>
297269
</plugins>

0 commit comments

Comments
 (0)