Skip to content

🛠️ Publish to Sonatype #17

🛠️ Publish to Sonatype

🛠️ Publish to Sonatype #17

Workflow file for this run

name: 🛠️ Publish to Sonatype
on:
release:
types: [published]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code and clone submodules
- name: Checkout code and clone submodules
uses: actions/checkout@v4
# Step 2: Set up JDK 21
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: "21"
distribution: "temurin"
# Step 4: Setup Gradle
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
with:
cache-read-only: false
# Step 5: Grant execute permissions to gradlew
- name: Grant execute permissions to gradlew
run: chmod +x ./gradlew
# Step 6: Set version based on the release tag
- name: Set version based on release tag
run: echo VERSION=$(echo "${GITHUB_REF}" | sed 's/refs\/tags\///') >> $GITHUB_ENV
# Step 7: Build the project using Gradle
- name: Build with Gradle
run: ./gradlew build
# Step 8: Publish the project to Sonatype OSSRH
- name: Publish to Sonatype OSSRH
run: ./gradlew publish && ./gradlew jreleaserFullRelease
env:
JRELEASER_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.JRELEASER_GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.JRELEASER_MAVENCENTRAL_USERNAME }}
# Step 9: Send notification to Discord
- name: Send notification to Discord
uses: SethCohen/[email protected]
with:
webhook_url: ${{ secrets.DISCORD_WEBHOOK_URL }}
color: "391879"
username: "Java SDK"