Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
38 changes: 5 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@
<system>GitHub Actions</system>
<url>https://github.com/databricks/databricks-sdk-java/blob/main/.github/workflows/push.yml</url>
</ciManagement>
<distributionManagement>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<properties>
<jacoco.version>0.8.10</jacoco.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -263,35 +257,13 @@
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<configuration>
<!-- Prevent gpg from using pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
<goals>
<goal>sign</goal>
</goals>
<phase>verify</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.5.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
</plugins>
Expand Down
Loading