From 67424d31312bfdb80d943578b10620bd523a11b9 Mon Sep 17 00:00:00 2001 From: Madalin Ilie Date: Fri, 22 Nov 2024 10:15:34 +0200 Subject: [PATCH] chore: Setup java only once and then build and deploy --- .../workflows/release-to-maven-central.yml | 27 ++++++------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release-to-maven-central.yml b/.github/workflows/release-to-maven-central.yml index 33903e87..c6b3f4aa 100644 --- a/.github/workflows/release-to-maven-central.yml +++ b/.github/workflows/release-to-maven-central.yml @@ -14,36 +14,25 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 21 + - name: Set up Apache Maven Central uses: actions/setup-java@v3 with: distribution: 'temurin' - java-version: 21 + java-version: '21' + server-id: central + server-username: ${{ secrets.OSSRH_USERNAME}} + server-password: ${{ secrets.OSSRH_PASSWORD }} + gpg-private-key: ${{ secrets.GPG_SIGN_KEY }} + gpg-passphrase: ${{ secrets.GPG_SIGN_PASSPHRASE }} - name: Set projects Maven version to GitHub Action GUI set version run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" - name: Build with Maven run: | - mvn -B clean --file pom.xml mvn -B package --file pom.xml -DskipTests=true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Apache Maven Central - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '21' - server-id: central - server-username: ${{ secrets.OSSRH_USERNAME}} - server-password: ${{ secrets.OSSRH_PASSWORD }} - gpg-private-key: ${{ secrets.GPG_SIGN_KEY }} - gpg-passphrase: ${{ secrets.GPG_SIGN_PASSPHRASE }} - - name: Publish to Apache Maven Central - run: mvn -B deploy -Psign --file pom.xml - env: - MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME}} - MAVEN_CENTRAL_TOKEN: ${{ secrets.OSSRH_PASSWORD }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGN_PASSPHRASE }} \ No newline at end of file + run: mvn -B deploy -Psign --file pom.xml \ No newline at end of file