From fba07323380acffd5433ce9041ee3596e1195450 Mon Sep 17 00:00:00 2001 From: 8naama Date: Tue, 31 Dec 2024 11:24:37 +0200 Subject: [PATCH] update release workflow --- .github/workflows/mvn-deploy-release.yaml | 39 +++++++++-------------- pom.xml | 29 +++++++++++++++++ 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/.github/workflows/mvn-deploy-release.yaml b/.github/workflows/mvn-deploy-release.yaml index 6b4fb08..19db719 100644 --- a/.github/workflows/mvn-deploy-release.yaml +++ b/.github/workflows/mvn-deploy-release.yaml @@ -1,37 +1,28 @@ -name: Logback Appender Maven CI +name: Release new version to Maven on: release: - types: [created] + types: [published] jobs: publish: runs-on: ubuntu-latest - env: - OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} - OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} - GPG_KEY: ${{ secrets.GPG_KEY }} - GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - MVN_MASTER_PASSWORD: ${{ secrets.MVN_MASTER_PASSWORD }} steps: - - name: Check out Git repository + - name: Get the code uses: actions/checkout@v4 - - name: Install Java and Maven + - name: Setup Java 11 uses: actions/setup-java@v4 with: java-version: 11 distribution: 'zulu' - - name: Create settings-security.xml - run: | - echo '' > ~/.m2/settings-security.xml - echo " ${{ secrets.MVN_MASTER_PASSWORD }}" >> ~/.m2/settings-security.xml - echo '' >> ~/.m2/settings-security.xml - - name: Release Maven package - uses: samuelmeuli/action-maven-publish@v1.4.0 - with: - maven_profiles: deploy - gpg_private_key: ${{ secrets.GPG_KEY }} - gpg_passphrase: ${{ secrets.GPG_PASSPHRASE }} - nexus_username: ${{ secrets.OSSRH_USERNAME }} - nexus_password: ${{ secrets.OSSRH_PASSWORD }} - server_id: ossrh-nexus + server-id: ossrh-nexus + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.GPG_KEY }} + gpg-passphrase: GPG_PASSPHRASE + - name: Publish to the Maven Central Repository + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: mvn deploy --batch-mode -D skipTests --activate-profiles release --no-transfer-progress \ No newline at end of file diff --git a/pom.xml b/pom.xml index 80b51bc..4c78753 100644 --- a/pom.xml +++ b/pom.xml @@ -211,4 +211,33 @@ test + + + + release + + + + org.apache.maven.plugins + maven-gpg-plugin + + + sign-artifacts + verify + + sign + + + + --pinentry-mode + loopback + + + + + + + + +