From ff287a54573cf8330253eab8a8c3e089447b8760 Mon Sep 17 00:00:00 2001 From: Ilayaperumal Gopinathan Date: Wed, 29 Jan 2025 17:23:12 +0000 Subject: [PATCH] Add maven central release GH Action workflow --- .../workflows/new-maven-central-release.yml | 48 +++++++++++++++++++ pom.xml | 38 +++++++++++++++ settings.xml | 8 +++- 3 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/new-maven-central-release.yml diff --git a/.github/workflows/new-maven-central-release.yml b/.github/workflows/new-maven-central-release.yml new file mode 100644 index 000000000..86ee9642b --- /dev/null +++ b/.github/workflows/new-maven-central-release.yml @@ -0,0 +1,48 @@ +name: Release to Maven Central + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: "Release version" + required: true + +jobs: + build: + name: Release project + runs-on: ubuntu-latest + + steps: + + - name: Check out sources + uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: 17 + cache: 'maven' + + - name: Install GPG key + run: | + echo "${{ secrets.GPG_PRIVATE_KEY }}" > gpg.asc + echo "${{ secrets.GPG_PASSPHRASE }}" | gpg --batch --yes --passphrase-fd 0 --import gpg.asc + + - name: Release to Sonatype OSSRH + env: + SONATYPE_USER: ${{ secrets.OSSRH_S01_TOKEN_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.OSSRH_S01_TOKEN_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: | + ./mvnw -B clean install -DskipTests + ./mvnw -B clean deploy -Psonatype -s settings.xml + + - name: Setup Graphviz + uses: ts-graphviz/setup-graphviz@v1 + + - name: Deploy documentation + env: + ARTIFACTORY_USERNAME: ${{ secrets.ARTIFACTORY_USERNAME }} + ARTIFACTORY_PASSWORD: ${{ secrets.ARTIFACTORY_PASSWORD }} + run: ./mvnw -B clean deploy -Pdocumentation \ No newline at end of file diff --git a/pom.xml b/pom.xml index b3088a009..664e3b4c2 100644 --- a/pom.xml +++ b/pom.xml @@ -794,6 +794,44 @@ + + sonatype + + true + + + + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.7.0 + true + + sonatype-new + https://s01.oss.sonatype.org/ + true + true + + + + + diff --git a/settings.xml b/settings.xml index e86c33787..8e881c331 100644 --- a/settings.xml +++ b/settings.xml @@ -35,6 +35,12 @@ ${env.ARTIFACTORY_USERNAME} ${env.ARTIFACTORY_PASSWORD} + + + sonatype-new + ${env.SONATYPE_USER} + ${env.SONATYPE_PASSWORD} + - \ No newline at end of file +