From 99519589db47e5ab6d6c7669b2a9d071f77a857e Mon Sep 17 00:00:00 2001 From: eschleb Date: Wed, 2 Oct 2024 07:37:32 +0200 Subject: [PATCH] Replace s4u/maven-settings-action with simple ci/mvnsettings.xml file - action was unable to set server with only id and passphrase ("servers must contain id, and username or configuration") --- .../workflows/release-and-deploy-release.yml | 43 +++++-------------- .github/workflows/verify.yml | 14 ++---- ci/mvnsettings.xml | 22 ++++++++++ 3 files changed, 37 insertions(+), 42 deletions(-) create mode 100644 ci/mvnsettings.xml diff --git a/.github/workflows/release-and-deploy-release.yml b/.github/workflows/release-and-deploy-release.yml index 33049f8..c1d6623 100644 --- a/.github/workflows/release-and-deploy-release.yml +++ b/.github/workflows/release-and-deploy-release.yml @@ -7,9 +7,7 @@ on: jobs: release: - runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v2 @@ -19,17 +17,11 @@ jobs: uses: actions/setup-java@v1 with: java-version: 17 - - name: Maven setup - uses: s4u/maven-settings-action@v3.0.0 - with: - servers: | - [{ - "id": "magnolia.enterprise.group", - "username": "${{secrets.MGNL_NEXUS_USER}}", - "password": "${{secrets.MGNL_NEXUS_PASS}}" - }] - name: Maven verify - run: mvn verify --batch-mode + run: mvn -s ci/mvnsettings.xml verify --batch-mode + env: + MAGNOLIA_REPO_USER: ${{ secrets.MGNL_NEXUS_USER }} + MAGNOLIA_REPO_PASSWORD: ${{ secrets.MGNL_NEXUS_PASS }} # Install xmllint - name: Install dependencies run: sudo apt-get update && sudo apt-get install libxml2-utils @@ -45,7 +37,6 @@ jobs: ci/mvn-release.sh deploy-release: - needs: release runs-on: ubuntu-latest @@ -60,23 +51,11 @@ jobs: distribution: temurin java-version: 17 gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - - name: Maven setup - uses: s4u/maven-settings-action@v3.0.0 - with: - servers: | - [{ - "id": "magnolia.enterprise.group", - "username": "${{secrets.MGNL_NEXUS_USER}}", - "password": "${{secrets.MGNL_NEXUS_PASS}}" - }, - { - "id": "central", - "username": "${{secrets.SONATYPE_USER}}", - "password": "${{secrets.SONATYPE_PASSWORD}}" - }, - { - "id": "gpg.passphrase", - "passphrase": "${{secrets.GPG_PASSPHRASE}}" - }] - name: Release Maven package - run: mvn deploy -Pdeploy \ No newline at end of file + run: mvn -s ci/mvnsettings.xml deploy -Pdeploy + env: + MAVEN_USERNAME: ${{ secrets.SONATYPE_USER }} + MAVEN_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + MAGNOLIA_REPO_USER: ${{ secrets.MGNL_NEXUS_USER }} + MAGNOLIA_REPO_PASSWORD: ${{ secrets.MGNL_NEXUS_PASS }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} \ No newline at end of file diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index a049e99..c3fb5af 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -16,14 +16,8 @@ jobs: with: distribution: temurin java-version: 17 - - name: Maven setup - uses: s4u/maven-settings-action@v3.0.0 - with: - servers: | - [{ - "id": "magnolia.enterprise.group", - "username": "${{secrets.MGNL_NEXUS_USER}}", - "password": "${{secrets.MGNL_NEXUS_PASS}}" - }] - name: Maven verify - run: mvn verify --batch-mode \ No newline at end of file + run: mvn -s ci/mvnsettings.xml verify --batch-mode + env: + MAGNOLIA_REPO_USER: ${{ secrets.MGNL_NEXUS_USER }} + MAGNOLIA_REPO_PASSWORD: ${{ secrets.MGNL_NEXUS_PASS }} \ No newline at end of file diff --git a/ci/mvnsettings.xml b/ci/mvnsettings.xml new file mode 100644 index 0000000..61a39a2 --- /dev/null +++ b/ci/mvnsettings.xml @@ -0,0 +1,22 @@ + + + + + magnolia.enterprise.group + ${env.MAGNOLIA_REPO_USER} + ${env.MAGNOLIA_REPO_PASSWORD} + + + central + ${env.MAVEN_USERNAME} + ${env.MAVEN_PASSWORD} + + + + gpg.passphrase + ${env.MAVEN_GPG_PASSPHRASE} + + +