diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d7d9618d7..d8fd47152 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,10 +1,19 @@
name: Release
+
on:
push:
+ # Run a real release on pushes to tags like v1.0, v2.3.4, etc.
tags:
- "v*"
+ # Run a dry-run on pushes to any branch
+ branches:
+ - "**"
+
jobs:
publish:
+ # Dynamically set the job name based on the trigger
+ name: ${{ startsWith(github.ref, 'refs/tags/') && 'Publish Release' || 'Run Release Dry-Run' }}
+
runs-on:
group: databricks-deco-testing-runner-group
labels: ubuntu-latest-deco
@@ -17,21 +26,26 @@ jobs:
uses: actions/setup-java@v3
with:
java-version: 8
- server-id: ossrh
+ server-id: central
distribution: "adopt"
- server-username: OSSRH_USERNAME
- server-password: OSSRH_PASSWORD
+ server-username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
+ server-password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- gpg-passphrase: GPG_PASSPHRASE
+ gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }}
+
+ # This step runs ONLY on branch pushes (dry-run)
+ - name: Run Release Dry-Run (Verify)
+ if: "!startsWith(github.ref, 'refs/tags/')"
+ run: mvn -Prelease -DskipTests=true --batch-mode verify
- - name: Publish to the Maven Central Repository
+ # This step runs ONLY on tag pushes (real release)
+ - name: Publish to Maven Central Repository (Deploy)
+ if: "startsWith(github.ref, 'refs/tags/')"
run: mvn -Prelease -DskipTests=true --batch-mode deploy
- env:
- GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
- OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
+ # This step also runs ONLY on tag pushes (real release)
- name: Create GitHub release
+ if: "startsWith(github.ref, 'refs/tags/')"
uses: softprops/action-gh-release@v1
with:
- files: target/*.jar
+ files: target/*.jar
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 8338221d5..56aedf430 100644
--- a/pom.xml
+++ b/pom.xml
@@ -48,12 +48,6 @@
GitHub Actions
https://github.com/databricks/databricks-sdk-java/blob/main/.github/workflows/push.yml
-
-
- ossrh
- https://oss.sonatype.org/service/local/staging/deploy/maven2/
-
-
0.8.10
UTF-8
@@ -263,35 +257,13 @@
- org.apache.maven.plugins
- maven-gpg-plugin
- 1.6
-
-
-
- --pinentry-mode
- loopback
-
-
-
-
- sign-artifacts
-
- sign
-
- verify
-
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.13
+ org.sonatype.central
+ central-publishing-maven-plugin
+ 0.5.0
true
- ossrh
- https://oss.sonatype.org/
- true
+ central
+ true